All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Fionn" <fionn@fionn.email>
To: "SZEDER Gábor" <szeder.dev@gmail.com>,
	"Fionn via GitGitGadget" <gitgitgadget@gmail.com>
Cc: <git@vger.kernel.org>,
	"Felipe Contreras" <felipe.contreras@gmail.com>,
	"Fionn" <git@fionn.email>
Subject: Re: [PATCH] completion: exclude previous file arguments in Zsh
Date: Mon, 05 Oct 2026 00:17:04 +0800	[thread overview]
Message-ID: <DLW6TDPQ9DA8.3CY39XL14GO9E@fionn.email> (raw)
In-Reply-To: <asIJO3CZ/P/2L4qi@szeder.dev>

> "existing arguments" of what?

Of a subcommand that takes paths.

> I don't do Zsh, but that 2 as index looks suspicious.

Fair to be suspicious. word[1] is the subcommand (e.g. "add"), so we 
index from 2 on in order to skip it. This is independent of where the 
subcommand appears in the entire command line.

> What will be excluded in the following command line:
>
>   git -C dir -C subdir -c foo.bar=baz add file1 file2 <TAB>
>
> I think we should exclude only those arguments that come after the git
> command, in this case after "add", i.e. "file1" and "file2", but I
> suspect that everything starting with "dir" will get excluded.

In my testing this works correctly (i.e. file1 and file2 are not offered 
as completion candidates any more, but if e.g. dir or foo exist in the 
subdirectory, they would be offered).

I've been dogfooding this for about 8 months on and off. Occasionally 
completion candidates I'd hope would be excluded are present, but this 
is because the fallback completion bypasses __gitcomp_file, which is a 
separate issue. I have not yet encountered completion candidates being 
unexpectedly excluded.

An easy way to test this is to link git-completion.zsh to _git and then 
add

    fpath=(/path/to/directory/containing/_git/file $fpath[@])

to ~/.zshrc, or similar.

  reply	other threads:[~2026-10-04 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-03 11:22 [PATCH] completion: exclude previous file arguments in Zsh Fionn via GitGitGadget
2026-10-04  8:07 ` SZEDER Gábor
2026-10-04 16:17   ` Fionn [this message]
2026-10-04 21:13   ` Junio C Hamano
2026-10-05  1:44     ` Fionn

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

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

  git send-email \
    --in-reply-to=DLW6TDPQ9DA8.3CY39XL14GO9E@fionn.email \
    --to=fionn@fionn.email \
    --cc=felipe.contreras@gmail.com \
    --cc=git@fionn.email \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=szeder.dev@gmail.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.