diff options
author | Denton Liu <liu.denton@gmail.com> | 2021-03-24 01:36:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-24 10:05:47 -0700 |
commit | e94fb4404280c07a668b4669c072983cdd079592 (patch) | |
tree | f32840e03a63a1e3cef70d540d5f06f122c1196b /t/t4012-diff-binary.sh | |
parent | Git 2.31 (diff) | |
download | tgif-e94fb4404280c07a668b4669c072983cdd079592.tar.xz |
git-completion.bash: pass $__git_subcommand_idx from __git_main()
Many completion functions perform hardcoded comparisons with $cword.
This fails in the case where the main git command is given arguments
(e.g. `git -C . bundle<TAB>` would fail to complete its subcommands).
Even _git_worktree(), which uses __git_find_on_cmdline(), could still
fail. With something like `git -C add worktree move<TAB>`, the
subcommand would be incorrectly identified as "add" instead of "move".
Assign $__git_subcommand_idx in __git_main(), where the git subcommand
is actually found and the corresponding completion function is called.
Use this variable to replace hardcoded comparisons with $cword.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4012-diff-binary.sh')
0 files changed, 0 insertions, 0 deletions