git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, David Aguilar <davvid@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] completion: zsh: trivial improvement
Date: Tue, 8 Jun 2021 07:01:15 +0200	[thread overview]
Message-ID: <20210608050115.GC6312@szeder.dev> (raw)
In-Reply-To: <20210608023807.907883-1-felipe.contreras@gmail.com>

On Mon, Jun 07, 2021 at 09:38:07PM -0500, Felipe Contreras wrote:
> $words has basically all the words we need, except the first one: git.
> 
> Lets simply add that instead of passing the original, which contains
> options we don't want to pass downstream (like --git-dir).

In our Bash completion script $words contains all words of the current
command on the command line, including 'git -C tmp -c foo.bar=baz'.

Why should zsh completion behave differently?

> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  contrib/completion/git-completion.zsh | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
> index cac6f61881..50f89145f3 100644
> --- a/contrib/completion/git-completion.zsh
> +++ b/contrib/completion/git-completion.zsh
> @@ -219,9 +219,6 @@ __git_zsh_main ()
>  {
>  	local curcontext="$curcontext" state state_descr line
>  	typeset -A opt_args
> -	local -a orig_words
> -
> -	orig_words=( ${words[@]} )
>  
>  	_arguments -C \
>  		'(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
> @@ -261,7 +258,7 @@ __git_zsh_main ()
>  
>  		(( $+opt_args[--help] )) && command='help'
>  
> -		words=( ${orig_words[@]} )
> +		words=( git ${words[@]} )
>  
>  		__git_zsh_bash_func $command
>  		;;
> -- 
> 2.32.0.2.g41be0a4e50
> 

  reply	other threads:[~2021-06-08  5:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08  2:38 [PATCH] completion: zsh: trivial improvement Felipe Contreras
2021-06-08  5:01 ` SZEDER Gábor [this message]
2021-06-08  5:37   ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210608050115.GC6312@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=davvid@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).