Skip to content

Commit 758b4e1

Browse files
scopgitster
authored andcommitted
completion: fix prompt with unset SHOWCONFLICTSTATE in nounset mode
`GIT_PS1_SHOWCONFLICTSTATE` is a user variable that might not be set, causing errors when the shell is in `nounset` mode. Take into account on access by falling back to an empty string. Signed-off-by: Ville Skyttä <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3c2a3fd commit 758b4e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/completion/git-prompt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ __git_ps1 ()
528528
fi
529529

530530
local conflict="" # state indicator for unresolved conflicts
531-
if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
531+
if [[ "${GIT_PS1_SHOWCONFLICTSTATE-}" == "yes" ]] &&
532532
[[ $(git ls-files --unmerged 2>/dev/null) ]]; then
533533
conflict="|CONFLICT"
534534
fi

0 commit comments

Comments
 (0)