Skip to content

Commit 8763dbb

Browse files
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 77ebd56 commit 8763dbb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/completion/git-completion.bash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ __git_ps1 ()
9999
elif [ -d "$g/rebase-merge" ]; then
100100
r="|REBASE-m"
101101
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)"
105102
else
103+
if [ -f "$g/MERGE_HEAD" ]; then
104+
r="|MERGING"
105+
fi
106106
if [ -f "$g/BISECT_LOG" ]; then
107107
r="|BISECTING"
108108
fi

0 commit comments

Comments
 (0)