completion: stop showing 'save' for stash by default

The 'save' subcommand in git stash has been deprecated in fd2ebf14db ("stash: mark "git stash save" deprecated in the man page", 2017-10-22). Stop showing it when the users enters 'git stash <tab>' or 'git stash s<tab>'. Keep showing it however when the user enters 'git stash sa<tab>' or any more characters of the 'save' subcommand. This is designed to not encourage users to use 'git stash save', but still leaving the completion option once it's clear that's what the user means. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Gummerer committed Apr 20, 2018 at 00:25 UTC 0eb5a4f91182d8c05fdc15597273d2381b112d7f
1 file changed +7 -2
contrib/completion/git-completion.bash
+7 -2
@@ -2774,13 +2774,18 @@ _git_show_branch ()
2774 _git_stash ()
2775 {
2776 local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
2777 - local subcommands='push save list show apply clear drop pop create branch'
2778 - local subcommand="$(__git_find_on_cmdline "$subcommands")"
2777 + local subcommands='push list show apply clear drop pop create branch'
2778 + local subcommand="$(__git_find_on_cmdline "$subcommands save")"
2779 if [ -z "$subcommand" ]; then
2780 case "$cur" in
2781 --*)
2782 __gitcomp "$save_opts"
2783 ;;
2784 + sa*)
2785 + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
2786 + __gitcomp "save"
2787 + fi
2788 + ;;
2789 *)
2790 if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
2791 __gitcomp "$subcommands"