Skip to contentSkip to conversation

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

PATCH In review Brandon Casey 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-completion.bash: replace zsh notation that breaks bash 3.X

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.

---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
index a4c48e1..c14e329 100644
@@ -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
Signature · 1 line
1.8.1.1.252.gdb33759
#1 lore raw

contrib/completion/git-completion.bash if [[ -n ${ZSH_VERSION-} ]]; then · line 2434

Quoted 1 line · Brandon Casey
contrib/completion/git-completion.bash +1 -0
+				array[$(($#array+1))]="$c"

You don't need $(( )) since the array index is already evaluated as an arithmethic expression.

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#2 lore raw
Quoted 6 lines · Andreas Schwab
Quoted 1 line · Brandon Casey

+ array[$(($#array+1))]="$c"

You don't need $(( )) since the array index is already evaluated as an arithmethic expression.

Ah, I didn't know that. Thanks.

I think Junio will probably fix this up if he thinks it's worth it, but I can resubmit if necessary.

-Brandon

#3 lore raw
Quoted 5 lines · Brandon Casey
Quoted 4 lines · Andreas Schwab
Quoted 1 line · Brandon Casey

+ array[$(($#array+1))]="$c"

Quoted 7 lines
Quoted 2 lines

You don't need $(( )) since the array index is already evaluated as an arithmethic expression.

Ah, I didn't know that. Thanks.

I think Junio will probably fix this up if he thinks it's worth it, but I can resubmit if necessary.

Please; I do not have mental bandwidth to keep track of contrib/ material myself.

#4 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 8 lines · Brandon Casey
Quoted 6 lines · Andreas Schwab
Quoted 1 line · Brandon Casey

+ array[$(($#array+1))]="$c"

You don't need $(( )) since the array index is already evaluated as an arithmethic expression.

Quoted 7 lines
Quoted 4 lines

Ah, I didn't know that. Thanks.

I think Junio will probably fix this up if he thinks it's worth it, but I can resubmit if necessary.

Please; I do not have mental bandwidth to keep track of contrib/ material myself.

No problem.

-Brandon

#5 lore raw

PATCH v2 1/1 git-completion.bash: replace zsh notation that breaks bash 3.X

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.

---

Quoted 6 lines · Andreas Schwab
Quoted 1 line · Brandon Casey

+ array[$(($#array+1))]="$c"

You don't need $(( )) since the array index is already evaluated as an arithmethic expression.

Fixed.

-Brandon

 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
contrib/completion/git-completion.bash +1 -1
index a4c48e1..2f99420 100644
@@ -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
Signature · 9 lines
1.7.8.4


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------