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 <paul@kungfoocoder.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Paul Wagland committed Jan 26, 2016 at 10:37 UTC d7d4ca87a9b44a3da5602714733adb6047f476c3
1 file changed +14 -3
contrib/completion/git-completion.bash
+14 -3
@@ -2381,7 +2381,7 @@ _git_show_branch ()
2381
2382 _git_stash ()
2383 {
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'
2385 local subcommands='save list show apply clear drop pop create branch'
2386 local subcommand="$(__git_find_on_cmdline "$subcommands")"
2387 if [ -z "$subcommand" ]; then
@@ -2403,9 +2403,20 @@ _git_stash ()
2403 apply,--*|pop,--*)
2404 __gitcomp "--index --quiet"
2405 ;;
2406 - show,--*|drop,--*|branch,--*)
2406 + drop,--*)
2407 + __gitcomp "--quiet"
2408 ;;
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,*)
2420 __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
2421 | sed -n -e 's/:.*//p')"
2422 ;;