1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-06 11:06:10 +02:00

Merge branch 'vs/complete-with-set-u-fix' into next

Another "set -u" fix for the bash prompt (in contrib/) script.

* vs/complete-with-set-u-fix:
  completion: protect prompt against unset SHOWUPSTREAM in nounset mode
  completion: fix prompt with unset SHOWCONFLICTSTATE in nounset mode
This commit is contained in:
Junio C Hamano 2024-04-02 14:27:45 -07:00
commit d8f6a511e8

View File

@ -141,7 +141,7 @@ __git_ps1_show_upstream ()
# parse configuration values
local option
for option in ${GIT_PS1_SHOWUPSTREAM}; do
for option in ${GIT_PS1_SHOWUPSTREAM-}; do
case "$option" in
git|svn) upstream_type="$option" ;;
verbose) verbose=1 ;;
@ -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