completion: protect prompt against unset SHOWUPSTREAM in nounset mode

As it stands, the only call site of `__git_ps1_show_upstream` checks that the `GIT_PS1_SHOWUPSTREAM` variable is set, so this is effectively a no-op. However, that might change, and chances of noticing the unprotected use might not be that high when it does. 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 19:07 UTC d7805bc74351e61126e587a7470e3fbf843caf8a
1 file changed +1 -1
contrib/completion/git-prompt.sh
+1 -1
@@ -141,7 +141,7 @@ __git_ps1_show_upstream ()
141
142 # parse configuration values
143 local option
144 - for option in ${GIT_PS1_SHOWUPSTREAM}; do
144 + for option in ${GIT_PS1_SHOWUPSTREAM-}; do
145 case "$option" in
146 git|svn) upstream_type="$option" ;;
147 verbose) verbose=1 ;;