@@ -26,6 +26,53 @@ gitstatus=$( LC_ALL=C git status ${_ignore_submodules} --untracked-files=${__GIT
2626# if the status is fatal, exit now
2727[[ " $? " -ne 0 ]] && exit 0
2828
29+ git_dir=" $( git rev-parse --git-dir 2> /dev/null) "
30+ [[ -z " $git_dir " ]] && exit 0
31+
32+ __git_prompt_read ()
33+ {
34+ local f=" $1 "
35+ shift
36+ test -r " $f " && read " $@ " < " $f "
37+ }
38+
39+ state=" "
40+ step=" "
41+ total=" "
42+ if [ -d " ${git_dir} /rebase-merge" ]; then
43+ __git_prompt_read " ${git_dir} /rebase-merge/msgnum" step
44+ __git_prompt_read " ${git_dir} /rebase-merge/end" total
45+ if [ -f " ${git_dir} /rebase-merge/interactive" ]; then
46+ state=" |REBASE-i"
47+ else
48+ state=" |REBASE-m"
49+ fi
50+ else
51+ if [ -d " ${git_dir} /rebase-apply" ]; then
52+ __git_prompt_read " ${git_dir} /rebase-apply/next" step
53+ __git_prompt_read " ${git_dir} /rebase-apply/last" total
54+ if [ -f " ${git_dir} /rebase-apply/rebasing" ]; then
55+ state=" |REBASE"
56+ elif [ -f " ${git_dir} /rebase-apply/applying" ]; then
57+ state=" |AM"
58+ else
59+ state=" |AM/REBASE"
60+ fi
61+ elif [ -f " ${git_dir} /MERGE_HEAD" ]; then
62+ state=" |MERGING"
63+ elif [ -f " ${git_dir} /CHERRY_PICK_HEAD" ]; then
64+ state=" |CHERRY-PICKING"
65+ elif [ -f " ${git_dir} /REVERT_HEAD" ]; then
66+ state=" |REVERTING"
67+ elif [ -f " ${git_dir} /BISECT_LOG" ]; then
68+ state=" |BISECTING"
69+ fi
70+ fi
71+
72+ if [ -n " $step " ] && [ -n " $total " ]; then
73+ state=" ${state} ${step} /${total} "
74+ fi
75+
2976num_staged=0
3077num_changed=0
3178num_conflicts=0
@@ -118,7 +165,7 @@ if [[ -z "$upstream" ]] ; then
118165fi
119166
120167printf " %s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
121- " $branch " \
168+ " ${ branch}${state} " \
122169 " $remote " \
123170 " $upstream " \
124171 $num_staged \
0 commit comments