Skip to content

Commit 471dcfd

Browse files
randomguy3gitster
authored andcommitted
contrib/completion: "local var=()" is misinterpreted as func-decl by zsh
Certain versions of zsh seems to treat local var=() as a function declaration, rather than an assignment of an empty array, although its documentation does not suggest that this should be the case. With zsh 4.3.15 on Fedora Core 15, this causes __git_ps1 " (%s)" to trigger an error message: local:2: command not found: svn_url_pattern when GIT_PS1_SHOWUPSTREAM="auto". Signed-off-by: Alex Merry <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75f4965 commit 471dcfd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ __gitdir ()
106106
__git_ps1_show_upstream ()
107107
{
108108
local key value
109-
local svn_remote=() svn_url_pattern count n
109+
local svn_remote svn_url_pattern count n
110110
local upstream=git legacy="" verbose=""
111111

112+
svn_remote=()
112113
# get some config options from git-config
113114
local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
114115
while read -r key value; do

0 commit comments

Comments
 (0)