Skip to content

Commit 0eb5a4f

Browse files
tgummerergitster
authored andcommitted
completion: stop showing 'save' for stash by default
The 'save' subcommand in git stash has been deprecated in fd2ebf1 ("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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fe0a9ea commit 0eb5a4f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

contrib/completion/git-completion.bash

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,13 +2774,18 @@ _git_show_branch ()
27742774
_git_stash ()
27752775
{
27762776
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")"
27792779
if [ -z "$subcommand" ]; then
27802780
case "$cur" in
27812781
--*)
27822782
__gitcomp "$save_opts"
27832783
;;
2784+
sa*)
2785+
if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
2786+
__gitcomp "save"
2787+
fi
2788+
;;
27842789
*)
27852790
if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
27862791
__gitcomp "$subcommands"

0 commit comments

Comments
 (0)