Code

bash: remove unnecessary conditions when checking for subcommands
authorSZEDER Gábor <szeder@ira.uka.de>
Mon, 10 Mar 2008 15:02:22 +0000 (16:02 +0100)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 10 Mar 2008 23:45:20 +0000 (19:45 -0400)
Checking emptyness of $command is sufficient.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
contrib/completion/git-completion.bash

index c29569c6247c346ceb409f72ff8e135929e11141..a94dc88fdc6c5f205bc423e3f7d78e755517118e 100755 (executable)
@@ -497,7 +497,7 @@ _git_bisect ()
                c=$((++c))
        done
 
-       if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
+       if [ -z "$command" ]; then
                __gitcomp "start bad good reset visualize replay log"
                return
        fi
@@ -1042,7 +1042,7 @@ _git_remote ()
                c=$((++c))
        done
 
-       if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
+       if [ -z "$command" ]; then
                __gitcomp "add rm show prune update"
                return
        fi
@@ -1135,7 +1135,7 @@ _git_submodule ()
                c=$((++c))
        done
 
-       if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
+       if [ -z "$command" ]; then
                local cur="${COMP_WORDS[COMP_CWORD]}"
                case "$cur" in
                --*)
@@ -1198,7 +1198,7 @@ _git ()
                c=$((++c))
        done
 
-       if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
+       if [ -z "$command" ]; then
                case "${COMP_WORDS[COMP_CWORD]}" in
                --*=*) COMPREPLY=() ;;
                --*)   __gitcomp "