git-completion.bash: consolidate cases in _git_stash()
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>
Denton Liu committed
Apr 22, 2021 at 03:00 UTC
7cdb0969037418b6f09b0a434e51cbf66090c624
1 file changed
+2
-19
contrib/completion/git-completion.bash
+2
-19
@@ -3032,21 +3032,6 @@ _git_stash ()
3032
fi
3033
3034
case "$subcommand,$cur" in
3035
- push,--*)
3036
- __gitcomp_builtin stash_push
3037
- ;;
3038
- save,--*)
3039
- __gitcomp_builtin stash_save
3040
- ;;
3041
- pop,--*)
3042
- __gitcomp_builtin stash_pop
3043
- ;;
3044
- apply,--*)
3045
- __gitcomp_builtin stash_apply
3046
- ;;
3047
- drop,--*)
3048
- __gitcomp_builtin stash_drop
3049
- ;;
3035
list,--*)
3036
# NEEDSWORK: can we somehow unify this with the options in _git_log() and _git_show()
3037
__gitcomp_builtin stash_list "$__git_log_common_options $__git_diff_common_options"
@@ -3054,8 +3039,8 @@ _git_stash ()
3039
show,--*)
3040
__gitcomp_builtin stash_show "$__git_diff_common_options"
3041
;;
3057
- branch,--*)
3058
- __gitcomp_builtin stash_branch
3042
+ *,--*)
3043
+ __gitcomp_builtin "stash_$subcommand"
3044
;;
3045
branch,*)
3046
if [ $cword -eq $((__git_cmd_idx+2)) ]; then
@@ -3069,8 +3054,6 @@ _git_stash ()
3054
__gitcomp_nl "$(__git stash list \
3055
| sed -n -e 's/:.*//p')"
3056
;;
3072
- *)
3073
- ;;
3057
esac
3058
}
3059