Skip to content

Commit

Permalink
Fix error when not running in a checkout.
Browse files Browse the repository at this point in the history
  • Loading branch information
edwh committed Jan 30, 2023
1 parent 1bcda40 commit 84099e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions resources/views/layouts/navbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
<?php
// We want to show the current branch. This will only be set on development or staging environments.
$branch = "Unknown branch";
@exec('git branch | ' . "grep ' * '", $shellOutput);
foreach ($shellOutput as $line) {
if (strpos($line, '* ') !== false) {
$branch = trim(strtolower(str_replace('* ', '', $line)));
if (is_dir('.git')) {
@exec('git branch | ' . "grep ' * '", $shellOutput);
foreach ($shellOutput as $line) {
if (strpos($line, '* ') !== false) {
$branch = trim(strtolower(str_replace('* ', '', $line)));
}
}
}
?>
Expand Down

0 comments on commit 84099e5

Please sign in to comment.