Thread (1 message) 1 message, 1 author, 2021-04-16

Re: [PATCH] completion: avoid aliased command lookup error in nounset mode

From: Junio C Hamano <hidden>
Date: 2021-04-16 20:40:54

Ville Skyttä [off-list ref] writes:
Aliased command lookup accesses the `list` variable before it has been
set, causing an error in "nounset" mode. Initialize to an empty string
to avoid that.

    $ git nonexistent-command <Tab>bash: list: unbound variable

Signed-off-by: Ville Skyttä <redacted>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, will queue.
quoted hunk
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index dfa735ea62..49e76e9d08 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1129,7 +1129,7 @@ __git_pretty_aliases ()
 # __git_aliased_command requires 1 argument
 __git_aliased_command ()
 {
-	local cur=$1 last list word cmdline
+	local cur=$1 last list= word cmdline
 
 	while [[ -n "$cur" ]]; do
 		if [[ "$list" == *" $cur "* ]]; then
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help