git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH] contrib/completion: avoid empty arithemetic expressions

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 30, 2021, 03:48 UTC
Message-ID
<60b30b159bda0_50fd208ee@natae.notmuch>
In-Reply-To
<20210530021528.21287-1-davvid@gmail.com>
David Aguilar wrote:
Show 11 quoted lines
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 3c5739b905..d51ff5302d 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1177,6 +1177,9 @@ __git_aliased_command ()
>  __git_find_on_cmdline ()
>  {
>  	local word c="$__git_cmd_idx" show_idx
> +	if [ -z "$c" ]; then
> +		c=1
> +	fi
This is not the correct location to fix this, it's here:
diff --git a/git-completion.zsh b/git-completion.zsh
index 0ef15ff..df98e68 100644
--- a/git-completion.zsh
+++ b/git-completion.zsh
@@ -233,7 +233,7 @@ __git_zsh_main ()
                emulate ksh -c __git_complete_config_variable_name_and_value
                ;;
        (arg)
-               local command="${words[1]}" __git_dir
+               local command="${words[1]}" __git_dir __git_cmd_idx=1
 
                if (( $+opt_args[--bare] )); then
                        __git_dir='.'

Commit 59d85a2a05 (git-completion.bash: use $__git_cmd_idx in more
places, 2021-04-22) broke zsh because it modified __git_main, but not
__git_zsh_main.

Cheers.
-- 
Felipe Contreras
Previous: David AguilarNext: David Aguilar
Message 2 of 3 in “contrib/completion: avoid empty arithemetic expressions”
  1. contrib/completion: avoid empty arithemetic expressionsDavid Aguilar, May 30, 2021
  2. Felipe ContrerasMay 30, 2021
  3. David AguilarMay 30, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.