Skip to content

Commit a4ee525

Browse files
authored
🔀 Merge pull request #25 from JohannesEH/patch-1
Fixed command result checks in Get-Git-MainBranch
2 parents dc38df7 + 8937512 commit a4ee525

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Get-Git-CurrentBranch {
1515
function Get-Git-MainBranch {
1616
git rev-parse --git-dir *> $null
1717

18-
if (-not $?) {
18+
if ($LASTEXITCODE -ne 0) {
1919
return
2020
}
2121

@@ -24,7 +24,7 @@ function Get-Git-MainBranch {
2424
foreach ($branch in $branches) {
2525
& git show-ref -q --verify refs/heads/$branch
2626

27-
if ($?) {
27+
if ($LASTEXITCODE -eq 0) {
2828
return $branch
2929
}
3030
}

0 commit comments

Comments
 (0)