git_prompt: show where rebase is at when stopped

Adds a progress indicator to the rebase messages. (e.g. |REBASE 2/5)

based on the git-prompt portion of git.git b71dc3e: "bash-prompt.sh:
show where rebase is at when stopped"
This commit is contained in:
Brian Gernhardt 2013-07-03 00:50:37 -04:00
parent 5a7b85adc7
commit 2a46b984cd

View file

@ -447,16 +447,23 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
set -l operation
set -l detached no
set -l bare
set -l step
set -l total
set -l os
if test -f $git_dir/rebase-merge/interactive
set operation "|REBASE-i"
set branch (cat $git_dir/rebase-merge/head-name ^/dev/null)
else if test -d $git_dir/rebase-merge
set operation "|REBASE-m"
if test -d $git_dir/rebase-merge
set branch (cat $git_dir/rebase-merge/head-name ^/dev/null)
set step (cat $git_dir/rebase-merge/msgnum ^/dev/null)
set total (cat $git_dir/rebase-merge/end ^/dev/null)
if test -f $git_dir/rebase-merge/interactive
set operation "|REBASE-i"
else
set operation "|REBASE-m"
end
else
if test -d $git_dir/rebase-apply
set step (cat $git_dir/rebase-apply/next ^/dev/null)
set total (cat $git_dir/rebase-apply/last ^/dev/null)
if test -f $git_dir/rebase-apply/rebasing
set operation "|REBASE"
else if test -f $git_dir/rebase-apply/applying
@ -475,6 +482,10 @@ function __fish_git_prompt_operation_branch_bare --description "__fish_git_promp
end
end
if test -n "$step" -a -n "$total"
set operation "$operation $step/$total"
end
if test -z "$branch"
set branch (git symbolic-ref HEAD ^/dev/null; set os $status)
if test $os -ne 0