summaryrefslogtreecommitdiff
path: root/log-tree.c
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2021-04-22 10:00:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-27 06:41:07 (GMT)
commit59d85a2a0528c3db2552b0786caac7bf0610c552 (patch)
treefcc76fd969abbefb6fa4c8353684b65bbc827219 /log-tree.c
parent87e629756f3bbd5125237f504f12e394c576b26d (diff)
downloadgit-59d85a2a0528c3db2552b0786caac7bf0610c552.zip
git-59d85a2a0528c3db2552b0786caac7bf0610c552.tar.gz
git-59d85a2a0528c3db2552b0786caac7bf0610c552.tar.bz2
git-completion.bash: use $__git_cmd_idx in more places
With the introduction of the $__git_cmd_idx variable in e94fb44042 (git-completion.bash: pass $__git_subcommand_idx from __git_main(), 2021-03-24), completion functions were able to know the index at which the git command is listed, allowing them to skip options that are given to the underlying git itself, not the corresponding command (e.g. `-C asdf` in `git -C asdf branch`). While most of the changes here are self-explanatory, some bear further explanation. For the __git_find_on_cmdline() and __git_find_last_on_cmdline() pair of functions, these functions are only ever called in the context of a git command completion function. These functions will only care about words after the command so we can safely ignore the words before this. For _git_worktree(), this change is technically a no-op (once the __git_find_last_on_cmdline change is also applied). It was in poor style to have hard-coded on the index right after `worktree`. In case `git worktree` were to ever learn to accept options, the current situation would be inflexible. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'log-tree.c')
0 files changed, 0 insertions, 0 deletions