[PATCH 2/2] bash: complete 'git stash' subcommands only once
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
contrib/completion/git-completion.bash | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d138bda..5ecdca0 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1087,7 +1087,22 @@ _git_show ()
_git_stash ()
{
- __gitcomp 'save list show apply clear'
+ local i c=1 command
+
+ while [ $c -lt $COMP_CWORD ]; do
+ i="${COMP_WORDS[c]}"
+ case "$i" in
+ save|list|show|apply|clear)
+ command="$i"
+ break
+ ;;
+ esac
+ c=$((++c))
+ done
+
+ if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
+ __gitcomp 'save list show apply clear'
+ fi
}
_git_submodule ()
--
1.5.4.3