@matheusbsbs / matheus-bagliano / commits / 918c03c2a7
Fork 0

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 <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Sep 15, 2009 at 12:21 UTC 918c03c2a7c8730dcfd413098b3dc05fa0f3166d
1 file changed +7 -7
contrib/completion/git-completion.bash
+7 -7
@@ -620,8 +620,8 @@ __git_aliased_command ()
620 done
621 }
622
623 -# __git_find_subcommand requires 1 argument
624 -__git_find_subcommand ()
623 +# __git_find_on_cmdline requires 1 argument
624 +__git_find_on_cmdline ()
625 {
626 local word subcommand c=1
627
@@ -740,7 +740,7 @@ _git_bisect ()
740 __git_has_doubledash && return
741
742 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")"
744 if [ -z "$subcommand" ]; then
745 __gitcomp "$subcommands"
746 return
@@ -1749,7 +1749,7 @@ _git_config ()
1749 _git_remote ()
1750 {
1751 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")"
1753 if [ -z "$subcommand" ]; then
1754 __gitcomp "$subcommands"
1755 return
@@ -1877,7 +1877,7 @@ _git_show_branch ()
1877 _git_stash ()
1878 {
1879 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")"
1881 if [ -z "$subcommand" ]; then
1882 __gitcomp "$subcommands"
1883 else
@@ -1908,7 +1908,7 @@ _git_submodule ()
1908 __git_has_doubledash && return
1909
1910 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
1912 local cur="${COMP_WORDS[COMP_CWORD]}"
1913 case "$cur" in
1914 --*)
@@ -1930,7 +1930,7 @@ _git_svn ()
1930 proplist show-ignore show-externals branch tag blame
1931 migrate
1932 "
1933 - local subcommand="$(__git_find_subcommand "$subcommands")"
1933 + local subcommand="$(__git_find_on_cmdline "$subcommands")"
1934 if [ -z "$subcommand" ]; then
1935 __gitcomp "$subcommands"
1936 else