Skip to content

Commit

Permalink
contrib/completion: "local var=()" is misinterpreted as func-decl by zsh
Browse files Browse the repository at this point in the history
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 <dev@randomguy3.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
randomguy3 authored and gitster committed Mar 21, 2012
1 parent 75f4965 commit 471dcfd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,10 @@ __gitdir ()
__git_ps1_show_upstream ()
{
local key value
local svn_remote=() svn_url_pattern count n
local svn_remote svn_url_pattern count n
local upstream=git legacy="" verbose=""

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

0 comments on commit 471dcfd

Please sign in to comment.