@matheusbsbs / matheus-bagliano / commits / 8763dbb1b2
Fork 0

completion: fix PS1 display during a merge on detached HEAD

If your merge stops in a conflict while on a detached HEAD, recent completion code fails to show anything. This was because various cases added to support the operation-in-progress markers (e.g. REBASE, MERGING) forgot that they need to set the variable "b" to something for the result they computed to be displayed at all. Probably not many people make trial merges on a detached HEAD (which is tremendously useful feature of git, by the way), and that may be why this was not noticed for a long time. Acked-By: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed May 16, 2009 at 11:46 UTC 8763dbb1b24c260243f69130c734c13563a16db6
1 file changed +3 -3
contrib/completion/git-completion.bash
+3 -3
@@ -99,10 +99,10 @@ __git_ps1 ()
99 elif [ -d "$g/rebase-merge" ]; then
100 r="|REBASE-m"
101 b="$(cat "$g/rebase-merge/head-name")"
102 - elif [ -f "$g/MERGE_HEAD" ]; then
103 - r="|MERGING"
104 - b="$(git symbolic-ref HEAD 2>/dev/null)"
102 else
103 + if [ -f "$g/MERGE_HEAD" ]; then
104 + r="|MERGING"
105 + fi
106 if [ -f "$g/BISECT_LOG" ]; then
107 r="|BISECTING"
108 fi