Re: Error in bash completion
- From
- Harrison McCullough <mccullough.harrison@gmail.com>
- Date
- Jun 17, 2021, 02:15 UTC
- Message-ID
- <CAHLeu+zcgrhvdqMWG1GegSP-y6CmJsJranxX-2MEGkhTaWWHMw@mail.gmail.com>
- In-Reply-To
- <60caae2f893ec_894e2085d@natae.notmuch>
I can verify that this fix works. Thank you for the quick response!
-Harrison McCullough
On Wed, Jun 16, 2021 at 8:06 PM Felipe Contreras <felipe.contreras@gmail.com> wrote:
Show 32 quoted lines
>
> Harrison McCullough wrote:
> > What did you do before the bug happened? (Steps to reproduce your issue)
> >
> > 1. Create a Bash function, e.g. `ga() { git add "${@:-.}"; }`
> > 2. Use the `__git_complete` function to add Bash tab completion for your custom
> > Bash function, e.g. `__git_complete ga git_add`
> > 3. Attempt to tab complete a file path, e.g. `ga my-incomplete-file-path<TAB>`
>
> I can reproduce this issue; it's caused by 59d85a2a05
> (git-completion.bash: use $__git_cmd_idx in more places, 2021-04-22)
> which is present in v2.32.
>
> The problem is that __git_find_on_cmdline now relies on __git_cmd_idx,
> which is not defined when you do __git_complete.
>
> The solution is to add __git_cmd_idx=1 to __git_func_wrap.
>
> zsh is also broken by the same change, and the fix is to do the same in
> the _git service.
>
> I've fixed this in git-completion's master branch [1].
>
> You are welcome to trying the fix.
>
> Cheers.
>
> [1] https://github.com/felipec/git-completion/commit/95b3b49
> [2] https://github.com/git/git/commit/59d85a2a05
>
> --
> Felipe Contreras