git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
AMAlex Merry <dev@randomguy3.me.uk>
Date
Sep 1, 2011, 13:47 UTC
Message-ID
<4E5F8CF3.3060304@randomguy3.me.uk>

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 <dev@randomguy3.me.uk>
---
 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
-- 
1.7.6
Next: Alex Merry
Message 1 of 4 in “Fix git-completion.bash for use in zsh”
  1. Fix git-completion.bash for use in zshAlex Merry, Sep 1, 2011
  2. Alex MerryMar 20, 2012
  3. Junio C HamanoMar 20, 2012
  4. Junio C HamanoMar 20, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.