Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Fix git-completion.bash for use in zsh

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:20

Alex Merry [off-list ref] writes:
This is just a reminder message, since I haven't heard anything back
on this, and it hasn't made its way into the repo.
I realise Felipe Contreras has been pushing a different approach to
making it work properly in zsh, but this should be a fairly innocuous
fix in the meantime.
Thanks.

"git grep 'local .*=('" tells me that there is only one such construct;
there is another hit but it is not an empty array "=()" but that assigns
"=($(some command output))" so presumably zsh does not mistake it for a
declaration.

Felipe, any comments?
Alex

On 01/09/11 14:47, Alex Merry wrote:
quoted
Certain versions (or option combinations) of zsh appear to treat
things like
local some_var=()
as a function declaration.  This makes errors appear when using it in
combination with the GIT_PS1_SHOWUPSTREAM option.

Signed-off-by: Alex Merry<redacted>
---
  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 5a83090..89de45d 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -106,8 +106,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
         while read key value; do
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help