summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2009-09-15 10:21:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-09-22 19:47:26 (GMT)
commit59d5eeee9f7e0cb71c10bde3da0fa01c3b3dbf8d (patch)
tree56e0333d99b3784c28363d06a17b42f1dfb2bbbf /contrib/completion
parent918c03c2a7c8730dcfd413098b3dc05fa0f3166d (diff)
downloadgit-59d5eeee9f7e0cb71c10bde3da0fa01c3b3dbf8d.zip
git-59d5eeee9f7e0cb71c10bde3da0fa01c3b3dbf8d.tar.gz
git-59d5eeee9f7e0cb71c10bde3da0fa01c3b3dbf8d.tar.bz2
bash: update 'git stash' completion
This update adds 'git stash (apply|pop) --quiet' and all options known to 'git stash save', and handles the DWIMery from 3c2eb80f (stash: simplify defaulting to "save" and reject unknown options, 2009-08-18). Care is taken to avoid offering subcommands in the DWIM case. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rwxr-xr-xcontrib/completion/git-completion.bash20
1 files changed, 16 insertions, 4 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 277af5e..7ebc61b 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1876,18 +1876,30 @@ _git_show_branch ()
_git_stash ()
{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ local save_opts='--keep-index --no-keep-index --quiet --patch'
local subcommands='save list show apply clear drop pop create branch'
local subcommand="$(__git_find_on_cmdline "$subcommands")"
if [ -z "$subcommand" ]; then
- __gitcomp "$subcommands"
+ case "$cur" in
+ --*)
+ __gitcomp "$save_opts"
+ ;;
+ *)
+ if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then
+ __gitcomp "$subcommands"
+ else
+ COMPREPLY=()
+ fi
+ ;;
+ esac
else
- local cur="${COMP_WORDS[COMP_CWORD]}"
case "$subcommand,$cur" in
save,--*)
- __gitcomp "--keep-index"
+ __gitcomp "$save_opts"
;;
apply,--*|pop,--*)
- __gitcomp "--index"
+ __gitcomp "--index --quiet"
;;
show,--*|drop,--*|branch,--*)
COMPREPLY=()