{"thread":{"id":"34523","subject":"Incompatible '+=' syntax in git-completion.bash","startedAt":"2013-07-24T01:54:04Z","lastAt":"2013-07-24T15:31:01Z","messageCount":2,"participants":["Matthew Wang","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"224015","messageId":"CAK6R3tz73t1HQ2AkeimFDGnmZbFT1PJ5idTbKt8QwsPOSaYqQg@mail.gmail.com","threadId":"34523","inReplyTo":null,"subject":"Incompatible '+=' syntax in git-completion.bash","fromName":"Matthew Wang","fromEmail":"mattwyl@gmail.com","sentAt":"2013-07-24T01:54:04Z","receivedAt":"2013-07-24T01:54:04Z","isPatch":false,"sender":{"key":"mattwyl@gmail.com","avatar":null},"body":"Hi there,\n\nI noticed a change in commit 734b2f0 on\ncontrib/completion/git-completion.bash which reverted a syntax fix for\n'+=' syntax [1], the syntax does not work for bash < 3.1.  As far as I\nknow, bash 3.0.x is still widely used on some old servers, could\nsomeone add the fix back again?\n\nThanks,\nMatt\n\n[1] https://github.com/git/git/commit/734b2f0532d847a9f566183982f83ddea8d8d197#commitcomment-3664571\n"},{"id":"224047","messageId":"7v38r46klm.fsf@alter.siamese.dyndns.org","threadId":"34523","inReplyTo":"CAK6R3tz73t1HQ2AkeimFDGnmZbFT1PJ5idTbKt8QwsPOSaYqQg@mail.gmail.com","subject":"Re: Incompatible '+=' syntax in git-completion.bash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-07-24T15:31:01Z","receivedAt":"2013-07-24T15:31:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthew Wang <mattwyl@gmail.com> writes:\n\n> I noticed a change in commit 734b2f0 on\n> contrib/completion/git-completion.bash which reverted a syntax fix for\n> '+=' syntax [1], the syntax does not work for bash < 3.1.  As far as I\n> know, bash 3.0.x is still widely used on some old servers, could\n> someone add the fix back again?\n\nDoes anybody know of a reason why a[$#a+1]=$c notation should not be\nused for zsh?  If there isn't, I think we should cherry-pick\n\n    50c5885e (git-completion.bash: replace zsh notation that breaks\n    bash 3.X, 2013-01-18)\n\nby Brandon on top of 'master' or on 6bf931a5 (Merge branch\n'fc/zsh-leftover-bits', 2013-06-02).\n\nThanks.\n\n-- >8 --\nFrom: Brandon Casey <drafnel@gmail.com>\nDate: Fri, 18 Jan 2013 11:24:01 -0800\nSubject: [PATCH] git-completion.bash: replace zsh notation that breaks bash 3.X\n\nWhen commit d8b45314 began separating the zsh completion from the bash\ncompletion, it introduced a zsh completion \"bridge\" section into the bash\ncompletion script for zsh users to use until they migrated to the zsh\nscript.  The zsh '+=()' append-to-array notation prevents bash 3.00.15 on\nCentOS 4.x from loading the completion script and breaks test 9902.  We can\neasily work around this by using standard Bash array notation.\n\nSigned-off-by: Brandon Casey <drafnel@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex a4c48e1..2f99420 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2431,7 +2431,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then\n \t\t\t\t--*=*|*.) ;;\n \t\t\t\t*) c=\"$c \" ;;\n \t\t\t\tesac\n-\t\t\t\tarray+=(\"$c\")\n+\t\t\t\tarray[$#array+1]=\"$c\"\n \t\t\tdone\n \t\t\tcompset -P '*[=:]'\n \t\t\tcompadd -Q -S '' -p \"${2-}\" -a -- array && _ret=0\n-- \n1.8.3.4-995-g2e35dd8\n"}]}