Skip to content

Commit 6df4b09

Browse files
avihgitster
authored andcommitted
git-prompt: fix uninitialized variable
First use is in the form: local var; ...; var=$var$whatever... If the variable was unset (as bash and others do after "local x"), then it would error if set -u is in effect. Also, many shells inherit the existing value after "local var" without init, but in this case it's unlikely to have a prior value. Now we initialize it. (local var= is enough, but local var="" is the custom in this file) Signed-off-by: Avi Halachmi (:avih) <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f037e60 commit 6df4b09

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/completion/git-prompt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1
116116
__git_ps1_show_upstream ()
117117
{
118118
local key value
119-
local svn_remote svn_url_pattern count n
119+
local svn_remote svn_url_pattern="" count n
120120
local upstream_type=git legacy="" verbose="" name=""
121121

122122
svn_remote=()

0 commit comments

Comments
 (0)