Skip to content

Commit

Permalink
Add rebase progress (step/total)
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Jul 31, 2018
1 parent 2aa72bf commit 24181d3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/GitUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function Get-GitBranch($gitDir = $(Get-GitDirectory), [Diagnostics.Stopwatch]$sw
Invoke-Utf8ConsoleCommand {
dbg 'Finding branch' $sw
$r = ''; $b = ''; $c = ''
$step = ''; $total = ''
if (Test-Path $gitDir/rebase-merge) {
dbg 'Found rebase-merge' $sw
if (Test-Path $gitDir/rebase-merge/interactive) {
Expand All @@ -75,10 +76,15 @@ function Get-GitBranch($gitDir = $(Get-GitDirectory), [Diagnostics.Stopwatch]$sw
$r = '|REBASE-m'
}
$b = "$(Get-Content $gitDir/rebase-merge/head-name)"
$step = "$(Get-Content $gitDir/rebase-merge/msgnum)"
$total = "$(Get-Content $gitDir/rebase-merge/end)"
}
else {
if (Test-Path $gitDir/rebase-apply) {
dbg 'Found rebase-apply' $sw
$step = "$(Get-Content $gitDir/rebase-merge/next)"
$total = "$(Get-Content $gitDir/rebase-merge/last)"

if (Test-Path $gitDir/rebase-apply/rebasing) {
dbg 'Found rebase-apply/rebasing' $sw
$r = '|REBASE'
Expand Down Expand Up @@ -153,6 +159,10 @@ function Get-GitBranch($gitDir = $(Get-GitDirectory), [Diagnostics.Stopwatch]$sw
}
}

if ($step -and $total) {
$r += " $step/$total"
}

"$c$($b -replace 'refs/heads/','')$r"
}
}
Expand Down

0 comments on commit 24181d3

Please sign in to comment.