Skip to content

Commit

Permalink
Merge a6b7455 into 9d82dd0
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Jan 27, 2020
2 parents 9d82dd0 + a6b7455 commit 2bf9aee
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/GitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,23 @@ public function addArgument(string $arg): void
/**
* Renders the arguments and options for the Git command.
*
* @return string|mixed[]
* @return string|string[]
*/
public function getCommandLine()
{
if ($this->executeRaw) {
return $this->getCommand();
}

$command = array_merge([$this->getCommand()], $this->buildOptions(), $this->args);
$command = [];

return array_filter($command, function ($value): bool {
return strlen($value) > 0;
});
foreach (array_merge([$this->getCommand()], $this->buildOptions(), $this->args) as $part) {
$value = (string) $part;
if (strlen($value) > 0) {
$command[] = $value;
}
}

return $command;
}
}

0 comments on commit 2bf9aee

Please sign in to comment.