aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2024-04-01 11:30:33 +0000
committerJunio C Hamano <gitster@pobox.com>2024-04-01 08:31:54 -0700
commit758b4e137349b8548ada07346ab82e82079b43a3 (patch)
tree11d2efcc00d3bd961f04a9fb14c6fe19b8365236
parent3c2a3fdc388747b9eaf4a4a4f2035c1c9ddb26d0 (diff)
downloadgit-758b4e137349b8548ada07346ab82e82079b43a3.tar.gz
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>
-rw-r--r--contrib/completion/git-prompt.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 71f179cba3..3826f52dec 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -528,7 +528,7 @@ __git_ps1 ()
fi
local conflict="" # state indicator for unresolved conflicts
- if [[ "${GIT_PS1_SHOWCONFLICTSTATE}" == "yes" ]] &&
+ if [[ "${GIT_PS1_SHOWCONFLICTSTATE-}" == "yes" ]] &&
[[ $(git ls-files --unmerged 2>/dev/null) ]]; then
conflict="|CONFLICT"
fi