Skip to content

Commit

Permalink
git-completion.bash: consolidate cases in _git_stash()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Denton-L authored and gitster committed Apr 27, 2021
1 parent 59d85a2 commit 7cdb096
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3032,30 +3032,15 @@ _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"
;;
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
Expand All @@ -3069,8 +3054,6 @@ _git_stash ()
__gitcomp_nl "$(__git stash list \
| sed -n -e 's/:.*//p')"
;;
*)
;;
esac
}

Expand Down

0 comments on commit 7cdb096

Please sign in to comment.