Skip to content

Commit 918c03c

Browse files
szedergitster
authored andcommitted
bash: rename __git_find_subcommand() to __git_find_on_cmdline()
__git_find_subcommand() was originally meant to check whether subcommands are already present on the command line. But the code is general enough to be used for checking the presence of command line options as well, and the next commit will use it for that purpose, so let's give it a more general name. Signed-off-by: SZEDER Gábor <[email protected]> Acked-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3696c4c commit 918c03c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

contrib/completion/git-completion.bash

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,8 @@ __git_aliased_command ()
620620
done
621621
}
622622

623-
# __git_find_subcommand requires 1 argument
624-
__git_find_subcommand ()
623+
# __git_find_on_cmdline requires 1 argument
624+
__git_find_on_cmdline ()
625625
{
626626
local word subcommand c=1
627627

@@ -740,7 +740,7 @@ _git_bisect ()
740740
__git_has_doubledash && return
741741

742742
local subcommands="start bad good skip reset visualize replay log run"
743-
local subcommand="$(__git_find_subcommand "$subcommands")"
743+
local subcommand="$(__git_find_on_cmdline "$subcommands")"
744744
if [ -z "$subcommand" ]; then
745745
__gitcomp "$subcommands"
746746
return
@@ -1749,7 +1749,7 @@ _git_config ()
17491749
_git_remote ()
17501750
{
17511751
local subcommands="add rename rm show prune update set-head"
1752-
local subcommand="$(__git_find_subcommand "$subcommands")"
1752+
local subcommand="$(__git_find_on_cmdline "$subcommands")"
17531753
if [ -z "$subcommand" ]; then
17541754
__gitcomp "$subcommands"
17551755
return
@@ -1877,7 +1877,7 @@ _git_show_branch ()
18771877
_git_stash ()
18781878
{
18791879
local subcommands='save list show apply clear drop pop create branch'
1880-
local subcommand="$(__git_find_subcommand "$subcommands")"
1880+
local subcommand="$(__git_find_on_cmdline "$subcommands")"
18811881
if [ -z "$subcommand" ]; then
18821882
__gitcomp "$subcommands"
18831883
else
@@ -1908,7 +1908,7 @@ _git_submodule ()
19081908
__git_has_doubledash && return
19091909

19101910
local subcommands="add status init update summary foreach sync"
1911-
if [ -z "$(__git_find_subcommand "$subcommands")" ]; then
1911+
if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
19121912
local cur="${COMP_WORDS[COMP_CWORD]}"
19131913
case "$cur" in
19141914
--*)
@@ -1930,7 +1930,7 @@ _git_svn ()
19301930
proplist show-ignore show-externals branch tag blame
19311931
migrate
19321932
"
1933-
local subcommand="$(__git_find_subcommand "$subcommands")"
1933+
local subcommand="$(__git_find_on_cmdline "$subcommands")"
19341934
if [ -z "$subcommand" ]; then
19351935
__gitcomp "$subcommands"
19361936
else

0 commit comments

Comments
 (0)