# [PATCH 1/2] bash: add missing 'git stash save' subcommand

2 messages from 2008-03-05 to 2008-03-05. Participants: SZEDER Gábor.
Thread: https://gitlist.dev/t/12522

## SZEDER Gábor, 2008-03-05 19:16

Subject: [PATCH 1/2] bash: add missing 'git stash save' subcommand
Message-ID: <9956781bfd3f6ec8776c055aa21a4d3d4a504623.1204725800.git.szeder@ira.uka.de>
URL: https://gitlist.dev/e/9956781bfd3f6ec8776c055aa21a4d3d4a504623.1204725800.git.szeder%40ira.uka.de

```
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8f70e1e..d138bda 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1087,7 +1087,7 @@ _git_show ()
 
 _git_stash ()
 {
-	__gitcomp 'list show apply clear'
+	__gitcomp 'save list show apply clear'
 }
 
 _git_submodule ()
-- 
1.5.4.3


```

## SZEDER Gábor, 2008-03-05 19:16

Subject: [PATCH 2/2] bash: complete 'git stash' subcommands only once
Message-ID: <59b1b35932d76bc6b8cc50d2a1184fec7d0d903d.1204725800.git.szeder@ira.uka.de>
URL: https://gitlist.dev/e/59b1b35932d76bc6b8cc50d2a1184fec7d0d903d.1204725800.git.szeder%40ira.uka.de
In-Reply-To: <9956781bfd3f6ec8776c055aa21a4d3d4a504623.1204725800.git.szeder@ira.uka.de>

```
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


```
