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

[PATCH] git-completion.bash: replace zsh notation that breaks bash 3.X

From
Brandon Casey <drafnel@gmail.com>
Date
Jan 18, 2013, 10:31 UTC
Message-ID
<1358505065-16913-1-git-send-email-drafnel@gmail.com>

When commit d8b45314 began separating the zsh completion from the bash completion, it introduced a zsh completion "bridge" section into the bash completion script for zsh users to use until they migrated to the zsh script. The zsh '+=()' append-to-array notation prevents bash 3.00.15 on CentOS 4.x from loading the completion script and breaks test 9902. We can easily work around this by using standard Bash array notation.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a4c48e1..c14e329 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2431,7 +2431,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then
 				--*=*|*.) ;;
 				*) c="$c " ;;
 				esac
-				array+=("$c")
+				array[$(($#array+1))]="$c"
 			done
 			compset -P '*[=:]'
 			compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
-- 
1.8.1.1.252.gdb33759
Next: Andreas Schwab
Message 1 of 6 in “git-completion.bash: replace zsh notation that breaks bash 3.X”
  1. git-completion.bash: replace zsh notation that breaks bash 3.XBrandon Casey, Jan 18, 2013
  2. Andreas SchwabJan 18, 2013
  3. Brandon CaseyJan 18, 2013
  4. Junio C HamanoJan 18, 2013
  5. Brandon CaseyJan 18, 2013
  6. git-completion.bash: replace zsh notation that breaks bash 3.XBrandon Casey, Jan 18, 2013

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.