RE: Error in bash completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux