From bb195e30442bc5206b30fa9a304e20ea8e96458f Mon Sep 17 00:00:00 2001 From: Jan Pecha Date: Sat, 10 Dec 2022 19:23:32 +0100 Subject: [PATCH] Runners: added OldGitRunner https://github.com/czproject/git-php/pull/82 https://github.com/czproject/git-php/issues/86 --- src/Runners/OldGitRunner.php | 34 ++++++++++++++++++++++++++++++++++ tests/GitPhp/OldGitRunner.phpt | 25 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/Runners/OldGitRunner.php create mode 100644 tests/GitPhp/OldGitRunner.phpt diff --git a/src/Runners/OldGitRunner.php b/src/Runners/OldGitRunner.php new file mode 100644 index 0000000..cb07136 --- /dev/null +++ b/src/Runners/OldGitRunner.php @@ -0,0 +1,34 @@ +runner = $runner !== NULL ? $runner : new CliRunner; + } + + + public function run($cwd, array $args, array $env = NULL) + { + if (($key = array_search('--end-of-options', $args)) !== FALSE) { + unset($args[$key]); + } + + return $this->runner->run($cwd, $args, $env); + } + + + public function getCwd() + { + return $this->runner->getCwd(); + } + } diff --git a/tests/GitPhp/OldGitRunner.phpt b/tests/GitPhp/OldGitRunner.phpt new file mode 100644 index 0000000..3019b1f --- /dev/null +++ b/tests/GitPhp/OldGitRunner.phpt @@ -0,0 +1,25 @@ +assert(['branch', 'master']); +$assertRunner->assert(['branch', 'develop']); +$assertRunner->assert(['checkout', 'develop']); +$assertRunner->assert(['merge', 'feature-1']); +$assertRunner->assert(['branch', '-d', 'feature-1']); +$assertRunner->assert(['checkout', 'master']); + +$repo = $git->open(__DIR__); +$repo->createBranch('master'); +$repo->createBranch('develop', TRUE); +$repo->merge('feature-1'); +$repo->removeBranch('feature-1'); +$repo->checkout('master');