Skip to content

Commit 9542d56

Browse files
dongsibogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 898f807 commit 9542d56

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

contrib/completion/git-prompt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ __git_ps1_show_upstream ()
137137
done <<< "$output"
138138

139139
# parse configuration values
140+
local option
140141
for option in ${GIT_PS1_SHOWUPSTREAM}; do
141142
case "$option" in
142143
git|svn) upstream="$option" ;;

0 commit comments

Comments
 (0)