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ä <ville.skytta@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ville Skyttä committed Apr 1, 2024 at 11:30 UTC 758b4e137349b8548ada07346ab82e82079b43a3
1 file changed +1 -1
contrib/completion/git-prompt.sh
+1 -1
@@ -528,7 +528,7 @@ __git_ps1 ()
528 fi
529
530 local conflict="" # state indicator for unresolved conflicts
531 - if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
531 + if [[ "${GIT_PS1_SHOWCONFLICTSTATE-}" == "yes" ]] &&
532 [[ $(git ls-files --unmerged 2>/dev/null) ]]; then
533 conflict="|CONFLICT"
534 fi