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>
This commit is contained in:

committed by
Junio C Hamano

parent
3c2a3fdc38
commit
758b4e1373
@ -528,7 +528,7 @@ __git_ps1 ()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local conflict="" # state indicator for unresolved conflicts
|
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
|
[[ $(git ls-files --unmerged 2>/dev/null) ]]; then
|
||||||
conflict="|CONFLICT"
|
conflict="|CONFLICT"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user