* [PATCH] completion: avoid aliased command lookup error in nounset mode
@ 2021-04-16 19:19 Ville Skyttä
2021-04-16 20:40 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Ville Skyttä @ 2021-04-16 19:19 UTC (permalink / raw)
To: git
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ä <ville.skytta@iki.fi>
---
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 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
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] completion: avoid aliased command lookup error in nounset mode
2021-04-16 19:19 [PATCH] completion: avoid aliased command lookup error in nounset mode Ville Skyttä
@ 2021-04-16 20:40 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2021-04-16 20:40 UTC (permalink / raw)
To: Ville Skyttä; +Cc: git
Ville Skyttä <ville.skytta@iki.fi> 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ä <ville.skytta@iki.fi>
> ---
> contrib/completion/git-completion.bash | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, will queue.
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-16 20:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 19:19 [PATCH] completion: avoid aliased command lookup error in nounset mode Ville Skyttä
2021-04-16 20:40 ` Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).