git-prompt.sh: localize option
in __git_ps1_show_upstream
The variable 'option' is used in __git_ps1_show_upstream() without being localized. This clobbers the variable the user may be using for other purposes, which is bad. Luckily, $option is not used to carry information around in the script as a global variable. The use of it in this script has very limited scope (namely, only inside this function), so just declare that it is "local". Signed-off-by: Sibo Dong <sibo.dong@outlook.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
898f80736c
commit
9542d56379
@ -137,6 +137,7 @@ __git_ps1_show_upstream ()
|
|||||||
done <<< "$output"
|
done <<< "$output"
|
||||||
|
|
||||||
# parse configuration values
|
# parse configuration values
|
||||||
|
local option
|
||||||
for option in ${GIT_PS1_SHOWUPSTREAM}; do
|
for option in ${GIT_PS1_SHOWUPSTREAM}; do
|
||||||
case "$option" in
|
case "$option" in
|
||||||
git|svn) upstream="$option" ;;
|
git|svn) upstream="$option" ;;
|
||||||
|
Reference in New Issue
Block a user