Skip to content

Commit d7d4ca8

Browse files
Paul Waglandgitster
authored andcommitted
completion: update completion arguments for stash
Add --all and --include-untracked to the git stash save completions. Add --quiet to the git stash drop completions. Update git stash branch so that the first argument expands out to the possible branch names, and the other arguments expand to the stash names. Signed-off-by: Paul Wagland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1b0b6dd commit d7d4ca8

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

contrib/completion/git-completion.bash

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,7 @@ _git_show_branch ()
23812381

23822382
_git_stash ()
23832383
{
2384-
local save_opts='--keep-index --no-keep-index --quiet --patch'
2384+
local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
23852385
local subcommands='save list show apply clear drop pop create branch'
23862386
local subcommand="$(__git_find_on_cmdline "$subcommands")"
23872387
if [ -z "$subcommand" ]; then
@@ -2403,9 +2403,20 @@ _git_stash ()
24032403
apply,--*|pop,--*)
24042404
__gitcomp "--index --quiet"
24052405
;;
2406-
show,--*|drop,--*|branch,--*)
2406+
drop,--*)
2407+
__gitcomp "--quiet"
24072408
;;
2408-
show,*|apply,*|drop,*|pop,*|branch,*)
2409+
show,--*|branch,--*)
2410+
;;
2411+
branch,*)
2412+
if [ $cword -eq 3 ]; then
2413+
__gitcomp_nl "$(__git_refs)";
2414+
else
2415+
__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
2416+
| sed -n -e 's/:.*//p')"
2417+
fi
2418+
;;
2419+
show,*|apply,*|drop,*|pop,*)
24092420
__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
24102421
| sed -n -e 's/:.*//p')"
24112422
;;

0 commit comments

Comments
 (0)