]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-completion.bash: consolidate cases in _git_stash()
authorDenton Liu <liu.denton@gmail.com>
Thu, 22 Apr 2021 10:00:52 +0000 (03:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Apr 2021 06:41:07 +0000 (15:41 +0900)
The $subcommand case statement in _git_stash() is quite repetitive.
Consolidate the cases together into one catch-all case to reduce the
repetition.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index 30c9a9761615a99c4ed67d1c934ae0ac571dcefb..7bce9a0112f7dcfe2b00e512058fb2ed0231746d 100644 (file)
@@ -3032,21 +3032,6 @@ _git_stash ()
        fi
 
        case "$subcommand,$cur" in
-       push,--*)
-               __gitcomp_builtin stash_push
-               ;;
-       save,--*)
-               __gitcomp_builtin stash_save
-               ;;
-       pop,--*)
-               __gitcomp_builtin stash_pop
-               ;;
-       apply,--*)
-               __gitcomp_builtin stash_apply
-               ;;
-       drop,--*)
-               __gitcomp_builtin stash_drop
-               ;;
        list,--*)
                # NEEDSWORK: can we somehow unify this with the options in _git_log() and _git_show()
                __gitcomp_builtin stash_list "$__git_log_common_options $__git_diff_common_options"
@@ -3054,8 +3039,8 @@ _git_stash ()
        show,--*)
                __gitcomp_builtin stash_show "$__git_diff_common_options"
                ;;
-       branch,--*)
-               __gitcomp_builtin stash_branch
+       *,--*)
+               __gitcomp_builtin "stash_$subcommand"
                ;;
        branch,*)
                if [ $cword -eq $((__git_cmd_idx+2)) ]; then
@@ -3069,8 +3054,6 @@ _git_stash ()
                __gitcomp_nl "$(__git stash list \
                                | sed -n -e 's/:.*//p')"
                ;;
-       *)
-               ;;
        esac
 }