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

Re: [PATCH] completion: use __gitcomp_builtin for format-patch

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Oct 22, 2018, 10:17 UTC
Message-ID
<20181022101719.GE30222@szeder.dev>
In-Reply-To
<20181021084102.8318-1-pclouds@gmail.com>
On Sun, Oct 21, 2018 at 10:41:02AM +0200, Nguyễn Thái Ngọc Duy wrote:
Show 28 quoted lines
> This helps format-patch gain completion for a couple new options,
> notably --range-diff.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  Of course it will be even better if I could complete the ref for
>  --range-diff=, but maybe another day.
> 
>  contrib/completion/git-completion.bash | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index c8fdcf8644..065b922777 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1533,12 +1533,8 @@ _git_fetch ()
>  }
>  
>  __git_format_patch_options="
> -	--stdout --attach --no-attach --thread --thread= --no-thread
> -	--numbered --start-number --numbered-files --keep-subject --signoff
> -	--signature --no-signature --in-reply-to= --cc= --full-index --binary
> -	--not --all --cover-letter --no-prefix --src-prefix= --dst-prefix=
> -	--inline --suffix= --ignore-if-in-upstream --subject-prefix=
> -	--output-directory --reroll-count --to= --quiet --notes
> +	--full-index --not --all --no-prefix --src-prefix=
> +	--dst-prefix= --notes
>  "

$__git_format_patch_options is also used when completing 'git send-email's options, thus removing all these options will badly affect that, and in fact makes 't9902-completion.sh' fail with:

  expecting success:
          test_completion "git send-email --cov" "--cover-letter " &&
          test_completion "git send-email ma" "master "
  
  --- expected    2018-10-22 09:03:42.255325418 +0000
  +++ out_sorted  2018-10-22 09:03:42.255325418 +0000
  @@ -1 +1 @@
  ---cover-letter
  +
  not ok 122 - send-email
  #
  #               test_completion "git send-email --cov" "--cover-letter " &&
  #               test_completion "git send-email ma" "master "
  #
Show 7 quoted lines
>  _git_format_patch ()
> @@ -1551,7 +1547,7 @@ _git_format_patch ()
>  		return
>  		;;
>  	--*)
> -		__gitcomp "$__git_format_patch_options"
> +		__gitcomp_builtin format-patch "$__git_format_patch_options"

You sent out a separate bugfix patch (i.e. not a patch series) "completion: fix __gitcomp_builtin no longer consider extra options" in:

  https://public-inbox.org/git/20181021083731.8009-1-pclouds@gmail.com/

and this patch makes the completion of 'git format-patch' also use extra options... So, does this patch really work without that bugfix?

Show 6 quoted lines
>  		return
>  		;;
>  	esac
> -- 
> 2.19.1.647.g708186aaf9
> 
Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 2 of 4 in “completion: use __gitcomp_builtin for format-patch”
  1. completion: use __gitcomp_builtin for format-patchNguyễn Thái Ngọc Duy, Oct 21, 2018
  2. SZEDER GáborOct 22, 2018
  3. Duy NguyenOct 22, 2018
  4. Johannes SchindelinOct 22, 2018

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.