From: SZEDER Gábor Date: Sun, 04 Oct 2026 08:07:23 GMT Subject: Re: [PATCH] completion: exclude previous file arguments in Zsh Message-ID: In-Reply-To: On Sat, Oct 03, 2026 at 11:22:06AM +0000, Fionn via GitGitGadget wrote: > We can get this with minor changes, however. Here we introduce an array > __git_file_exclude which we populate with existing arguments and then "existing arguments" of what? > tell compadd to exclude them, which closely matches the Zsh _git > completion behaviour (as well as common programs such as rm). > @@ -284,6 +284,8 @@ __git_zsh_main () > > (( $+opt_args[--help] )) && command='help' > > + __git_file_exclude=(${words[2,-1]:#${words[CURRENT]}}) I don't do Zsh, but that 2 as index looks suspicious. What will be excluded in the following command line: git -C dir -C subdir -c foo.bar=baz add file1 file2 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. > + > words=( ${orig_words[@]} ) > > __git_zsh_bash_func $command