Skip to content

Commit

Permalink
Merge pull request #671 from dahlbyk/rkeithhill/fix-670-minimal-branc…
Browse files Browse the repository at this point in the history
…h-ahead-behind-display

Fix #670 BranchBehindAndAheadDisplay minimal/compact bug
  • Loading branch information
rkeithhill authored Mar 28, 2019
2 parents b6351ba + fb91067 commit 1572423
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/GitPrompt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,27 @@ function Write-GitBranchStatus {
elseif ($s.BranchBehindAndAheadDisplay -eq "Compact") {
$branchStatusTextSpan.Text = ("{0}{1}{2}" -f $Status.BehindBy, $s.BranchBehindAndAheadStatusSymbol.Text, $Status.AheadBy)
}
else {
$branchStatusTextSpan.Text = $s.BranchBehindAndAheadStatusSymbol.Text
}
}
elseif ($Status.BehindBy -ge 1) {
# We are behind remote
if (($s.BranchBehindAndAheadDisplay -eq "Full") -Or ($s.BranchBehindAndAheadDisplay -eq "Compact")) {
$branchStatusTextSpan.Text = ("{0}{1}" -f $s.BranchBehindStatusSymbol.Text, $Status.BehindBy)
}
else {
$branchStatusTextSpan.Text = $s.BranchBehindStatusSymbol.Text
}
}
elseif ($Status.AheadBy -ge 1) {
# We are ahead of remote
if (($s.BranchBehindAndAheadDisplay -eq "Full") -or ($s.BranchBehindAndAheadDisplay -eq "Compact")) {
$branchStatusTextSpan.Text = ("{0}{1}" -f $s.BranchAheadStatusSymbol.Text, $Status.AheadBy)
}
else {
$branchStatusTextSpan.Text = $s.BranchAheadStatusSymbol.Text
}
}
else {
# This condition should not be possible but defaulting the variables to be safe
Expand Down

0 comments on commit 1572423

Please sign in to comment.