Skip to content

Commit 7cdb096

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 59d85a2 commit 7cdb096

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

contrib/completion/git-completion.bash

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,30 +3032,15 @@ _git_stash ()
30323032
fi
30333033

30343034
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-
;;
30503035
list,--*)
30513036
# NEEDSWORK: can we somehow unify this with the options in _git_log() and _git_show()
30523037
__gitcomp_builtin stash_list "$__git_log_common_options $__git_diff_common_options"
30533038
;;
30543039
show,--*)
30553040
__gitcomp_builtin stash_show "$__git_diff_common_options"
30563041
;;
3057-
branch,--*)
3058-
__gitcomp_builtin stash_branch
3042+
*,--*)
3043+
__gitcomp_builtin "stash_$subcommand"
30593044
;;
30603045
branch,*)
30613046
if [ $cword -eq $((__git_cmd_idx+2)) ]; then
@@ -3069,8 +3054,6 @@ _git_stash ()
30693054
__gitcomp_nl "$(__git stash list \
30703055
| sed -n -e 's/:.*//p')"
30713056
;;
3072-
*)
3073-
;;
30743057
esac
30753058
}
30763059

0 commit comments

Comments
 (0)