[PATCH 5/8] bash completion: More completions for 'git stash'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add branch subcommand to completions and USAGE for git-stash.sh.
Complete stash names for show, apply, drop, pop, and branch.
Add "--index" long option for apply.

Signed-off-by: Lee Marlow <lee.marlow@xxxxxxxxx>
---
 contrib/completion/git-completion.bash |   12 +++++++++++-
 git-stash.sh                           |    2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6a5c4cd..a292cbd 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1348,7 +1348,7 @@ _git_show_branch ()
 
 _git_stash ()
 {
-	local subcommands='save list show apply clear drop pop create'
+	local subcommands='save list show apply clear drop pop create branch'
 	local subcommand="$(__git_find_subcommand "$subcommands")"
 	if [ -z "$subcommand" ]; then
 		__gitcomp "$subcommands"
@@ -1358,6 +1358,16 @@ _git_stash ()
 		save,--*)
 			__gitcomp "--keep-index"
 			;;
+		apply,--*)
+			__gitcomp "--index"
+			;;
+		show,--*|apply,--*|drop,--*|pop,--*|branch,--*)
+			COMPREPLY=()
+			;;
+		show,*|apply,*|drop,*|pop,*|branch,*)
+			__gitcomp "$(git --git-dir="$(__gitdir)" stash list \
+					| sed -n -e 's/:.*//p')"
+			;;
 		*)
 			COMPREPLY=()
 			;;
diff --git a/git-stash.sh b/git-stash.sh
index d4609ed..5ad2c4b 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Copyright (c) 2007, Nanako Shiraishi
 
-USAGE='[  | save | list | show | apply | clear | drop | pop | create ]'
+USAGE='[  | save | list | show | apply | clear | drop | pop | create | branch ]'
 
 SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
-- 
1.6.0.rc1.48.g2b6032

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux