All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Merry <dev@randomguy3.me.uk>
To: Junio C Hamano <gitster@pobox.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
	git@vger.kernel.org, Alex Merry <dev@randomguy3.me.uk>
Subject: [PATCH v2] Fix git-completion.bash for use in zsh
Date: Wed, 21 Mar 2012 11:06:00 +0000	[thread overview]
Message-ID: <1332327960-5208-1-git-send-email-dev@randomguy3.me.uk> (raw)

zsh treats
  local some_var=()
as a function declaration, rather than an array declaration (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 produce the message
  local:2: command not found: svn_url_pattern
when GIT_PS1_SHOWUPSTREAM="auto", due to the line
  local svn_remote=() svn_url_pattern count n

Simply doing
  local some_var
  some_var=()
fixes the issue.

Signed-off-by: Alex Merry <dev@randomguy3.me.uk>
---

Here it is again, with a better commit message, and no whitespace issues (hopefully).


 contrib/completion/git-completion.bash |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0acbdda..092a34f 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -94,8 +94,9 @@ __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 ')"
-- 
1.7.6.5

             reply	other threads:[~2012-03-21 11:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21 11:06 Alex Merry [this message]
2012-03-21 17:05 ` [PATCH v2] Fix git-completion.bash for use in zsh Junio C Hamano
2012-03-25 17:47   ` Felipe Contreras
2012-04-07 13:09 ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332327960-5208-1-git-send-email-dev@randomguy3.me.uk \
    --to=dev@randomguy3.me.uk \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.