Skip to content

Commit

Permalink
Fix failing git integration command
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannik Zschiesche committed Jan 30, 2020
1 parent b3c43d0 commit e6d9b57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.0.3
=====

* (bug) Fix failing git integration command.


3.0.2
=====

Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"symfony/cache-contracts": "^2.0",
"symfony/config": "^5.0",
"symfony/dependency-injection": "^5.0",
"symfony/http-kernel": "^5.0",
"symfony/process": "^5.0"
"symfony/http-kernel": "^5.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.0",
Expand Down
13 changes: 4 additions & 9 deletions src/Git/GitIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Becklyn\Hosting\Git;

use Symfony\Component\Process\Process;

/**
* Integration with git.
*/
Expand All @@ -30,23 +28,20 @@ public function fetchHeadCommitHash () : ?string
return null;
}

$git = $this->run(["command", "-v", "git"]);
$git = $this->run('command -v git');

return null !== $git
? $this->run([$git, "rev-parse", "HEAD"])
? $this->run("{$git} rev-parse HEAD")
: null;
}


/**
* Runs the given command.
*/
private function run (array $command) : ?string
private function run (string $command) : ?string
{
$process = new Process($command);
$process->mustRun();

$result = \trim($process->getOutput());
$result = \trim(\shell_exec($command) ?? "");

return "" !== $result
? $result
Expand Down

0 comments on commit e6d9b57

Please sign in to comment.