Skip to contentSkip to conversation

fix global bash variable on __gitcompappend

PATCH New Márcio Almada 4 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix global bash variable on __gitcompappend

Hi,

This is how to reproduce the bug:

```
git checkout [tab-tab]
echo $x # outputs the name of the last branch on completion list
```

Or more directly:

```
__gitcompappend "something"
echo $x # outputs 'something'
```

Might not be a big deal, but it's annoying to know that $x is lurking.

Márcio Almada (1):
fix global bash variable leak on __gitcompappend

 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 fix global bash variable leak on __gitcompappend

---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
index 661a829..1620546 100644
@@ -186,7 +186,7 @@ fi
 
 __gitcompappend ()
 {
-	local i=${#COMPREPLY[@]}
+	local x i=${#COMPREPLY[@]}
 	for x in $1; do
 		if [[ "$x" == "$3"* ]]; then
 			COMPREPLY[i++]="$2$x$4"
Signature · 1 line
1.9.3
#2 lore raw

Re: [PATCH] fix global bash variable leak on __gitcompappend

Quoted 3 lines · Márcio Almada
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Nicely found and corrected. Please sign-off your patch and Cc area experts if you can find them (I'll do that this time for you).

Thanks.

Quoted 14 lines
contrib/completion/git-completion.bash +1 -1
index 661a829..1620546 100644
@@ -186,7 +186,7 @@ fi
 
 __gitcompappend ()
 {
-	local i=${#COMPREPLY[@]}
+	local x i=${#COMPREPLY[@]}
 	for x in $1; do
 		if [[ "$x" == "$3"* ]]; then
 			COMPREPLY[i++]="$2$x$4"
#3 lore raw

Re: [PATCH] fix global bash variable leak on __gitcompappend

Quoting Junio C Hamano <[email protected]>:

Quoted 19 lines
Quoted 3 lines · Márcio Almada
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Nicely found and corrected. Please sign-off your patch and Cc area experts if you can find them (I'll do that this time for you).

Thanks.

Quoted 8 lines
contrib/completion/git-completion.bash +0 -0
index 661a829..1620546 100644
@@ -186,7 +186,7 @@ fi
 
Quoted 7 lines

contrib/completion/git-completion.bash fi · line 192

Quoted 7 lines
contrib/completion/git-completion.bash +1 -1
 __gitcompappend ()
 {
-	local i=${#COMPREPLY[@]}
+	local x i=${#COMPREPLY[@]}
 	for x in $1; do
 		if [[ "$x" == "$3"* ]]; then
 			COMPREPLY[i++]="$2$x$4"

Looks good and obviously correct, imho even at -rc2 time.

Not sure whether it's maint-worthy, but just in case: it was introduced in v1.8.3-rc0~59^2~2.

#4 lore raw

Re: [PATCH] fix global bash variable leak on __gitcompappend

In reply to Junio C Hamano

2015-04-09 0:56 GMT-03:00 Junio C Hamano <[email protected]>:

Quoted 11 lines
Quoted 3 lines · Márcio Almada
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Nicely found and corrected. Please sign-off your patch and Cc area experts if you can find them (I'll do that this time for you).

Thanks.

Ok, I'll remember this next time. Thanks for your incredible work here.

Quoted 14 lines
Quoted 14 lines
contrib/completion/git-completion.bash +1 -1
index 661a829..1620546 100644
@@ -186,7 +186,7 @@ fi
 
 __gitcompappend ()
 {
-     local i=${#COMPREPLY[@]}
+     local x i=${#COMPREPLY[@]}
      for x in $1; do
              if [[ "$x" == "$3"* ]]; then
                      COMPREPLY[i++]="$2$x$4"
#5 lore raw

Re: [PATCH] fix global bash variable leak on __gitcompappend

Quoted 9 lines · Marcio Almada

2015-04-09 0:56 GMT-03:00 Junio C Hamano <[email protected]>:

Quoted 6 lines
Quoted 2 lines · Márcio Almada
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Nicely found and corrected. Please sign-off your patch and Cc area experts if you can find them (I'll do that this time for you).

Ok, I'll remember this next time. Thanks for your incredible work here.

Junio's implication was that you should reply to his message with:

Or re-send the patch with your sign-off added.