diff --git a/src/GitRepository.php b/src/GitRepository.php index 2ef6f83..cd8d5fa 100644 --- a/src/GitRepository.php +++ b/src/GitRepository.php @@ -570,6 +570,24 @@ public function execute(...$cmd) } + /** + * Runs command and returns result. + * @param mixed ...$args + * @return RunnerResult + * @throws GitException + */ + public function run(...$args) + { + $result = $this->runner->run($this->repository, $args); + + if (!$result->isOk()) { + throw new GitException("Command '{$result->getCommand()}' failed (exit-code {$result->getExitCode()}).", $result->getExitCode(), NULL, $result); + } + + return $result; + } + + /** * @param array $args * @return string[]|NULL @@ -602,22 +620,4 @@ protected function extractFromCommand(array $args, callable $filter = NULL) return $output; } - - - /** - * Runs command. - * @param mixed ...$args - * @return RunnerResult - * @throws GitException - */ - protected function run(...$args) - { - $result = $this->runner->run($this->repository, $args); - - if (!$result->isOk()) { - throw new GitException("Command '{$result->getCommand()}' failed (exit-code {$result->getExitCode()}).", $result->getExitCode(), NULL, $result); - } - - return $result; - } }