@matheusbsbs / matheus-bagliano / commits / 95d43780cf
Fork 0

bash completion: More completions for 'git stash'

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@gmail.com> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Lee Marlow committed Aug 4, 2008 at 23:50 UTC 95d43780cff575cfffeea881464c77f84f8d7244
2 files changed +12 -2
contrib/completion/git-completion.bash
+11 -1
@@ -1371,7 +1371,7 @@ _git_show_branch ()
1371
1372 _git_stash ()
1373 {
1374 - local subcommands='save list show apply clear drop pop create'
1374 + local subcommands='save list show apply clear drop pop create branch'
1375 local subcommand="$(__git_find_subcommand "$subcommands")"
1376 if [ -z "$subcommand" ]; then
1377 __gitcomp "$subcommands"
@@ -1381,6 +1381,16 @@ _git_stash ()
1381 save,--*)
1382 __gitcomp "--keep-index"
1383 ;;
1384 + apply,--*)
1385 + __gitcomp "--index"
1386 + ;;
1387 + show,--*|apply,--*|drop,--*|pop,--*|branch,--*)
1388 + COMPREPLY=()
1389 + ;;
1390 + show,*|apply,*|drop,*|pop,*|branch,*)
1391 + __gitcomp "$(git --git-dir="$(__gitdir)" stash list \
1392 + | sed -n -e 's/:.*//p')"
1393 + ;;
1394 *)
1395 COMPREPLY=()
1396 ;;
git-stash.sh
+1 -1
@@ -1,7 +1,7 @@
1 #!/bin/sh
2 # Copyright (c) 2007, Nanako Shiraishi
3
4 -USAGE='[ | save | list | show | apply | clear | drop | pop | create ]'
4 +USAGE='[ | save | list | show | apply | clear | drop | pop | create | branch ]'
5
6 SUBDIRECTORY_OK=Yes
7 OPTIONS_SPEC=