summaryrefslogtreecommitdiff
path: root/contrib/completion/git-completion.tcsh
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2021-03-24 08:36:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-24 17:05:47 (GMT)
commite94fb4404280c07a668b4669c072983cdd079592 (patch)
treef32840e03a63a1e3cef70d540d5f06f122c1196b /contrib/completion/git-completion.tcsh
parenta5828ae6b52137b913b978e16cd2334482eb4c1f (diff)
downloadgit-e94fb4404280c07a668b4669c072983cdd079592.zip
git-e94fb4404280c07a668b4669c072983cdd079592.tar.gz
git-e94fb4404280c07a668b4669c072983cdd079592.tar.bz2
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 'contrib/completion/git-completion.tcsh')
0 files changed, 0 insertions, 0 deletions