Skip to content

Commit a988936

Browse files
committed
Better git branch command
1 parent 9920bf2 commit a988936

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/PHPFUI/InstaDoc/Section/Git.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
2121
try
2222
{
2323
$repo = new \Gitonomy\Git\Repository($this->controller->getGitRoot());
24-
$result = $repo->run('show-branch');
24+
$branch = \trim($repo->run('rev-parse', ['--abbrev-ref', 'HEAD']));
2525
}
2626
catch (\Exception $e)
2727
{
@@ -31,8 +31,6 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
3131
return $container;
3232
}
3333

34-
$branch = \substr($result, \strpos($result, '[') + 1, \strpos($result, ']') - 1);
35-
3634
if (! $branch)
3735
{
3836
$container->add(new \PHPFUI\SubHeader("Invalid branch name: {$branch}"));

0 commit comments

Comments
 (0)