@matheusbsbs / matheus-bagliano / commits / d7107ca65f
Fork 0

completion: fix PS1 display during an AM on detached HEAD

This is a companion patch to previous 8763dbb (completion: fix PS1 display during a merge on detached HEAD, 2009-05-16). While rebasing or running am on a detached HEAD, the code failed to set $b (branch description) that enables the whole status display business. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed May 25, 2009 at 22:56 UTC d7107ca65f79c2d95bc327bee44c09073b4de631
1 file changed +11 -13
contrib/completion/git-completion.bash
+11 -13
@@ -84,26 +84,24 @@ __git_ps1 ()
84 if [ -n "$g" ]; then
85 local r
86 local b
87 - if [ -d "$g/rebase-apply" ]; then
88 - if [ -f "$g/rebase-apply/rebasing" ]; then
89 - r="|REBASE"
90 - elif [ -f "$g/rebase-apply/applying" ]; then
91 - r="|AM"
92 - else
93 - r="|AM/REBASE"
94 - fi
95 - b="$(git symbolic-ref HEAD 2>/dev/null)"
96 - elif [ -f "$g/rebase-merge/interactive" ]; then
87 + if [ -f "$g/rebase-merge/interactive" ]; then
88 r="|REBASE-i"
89 b="$(cat "$g/rebase-merge/head-name")"
90 elif [ -d "$g/rebase-merge" ]; then
91 r="|REBASE-m"
92 b="$(cat "$g/rebase-merge/head-name")"
93 else
103 - if [ -f "$g/MERGE_HEAD" ]; then
94 + if [ -d "$g/rebase-apply" ]; then
95 + if [ -f "$g/rebase-apply/rebasing" ]; then
96 + r="|REBASE"
97 + elif [ -f "$g/rebase-apply/applying" ]; then
98 + r="|AM"
99 + else
100 + r="|AM/REBASE"
101 + fi
102 + elif [ -f "$g/MERGE_HEAD" ]; then
103 r="|MERGING"
105 - fi
106 - if [ -f "$g/BISECT_LOG" ]; then
104 + elif [ -f "$g/BISECT_LOG" ]; then
105 r="|BISECTING"
106 fi
107