git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] Fix up the arguments for git stash.

From
PWPaul Wagland <paul@kungfoocoder.org>
Date
Jan 23, 2016, 01:30 UTC
Message-ID
<20160123013049.GB28197@wagland.net>
In-Reply-To
<20160123012316.GA27965@wagland.net>
Signed-off-by: Paul Wagland <paul@kungfoocoder.org>
---
 contrib/completion/git-completion.bash | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 63754bc..043d5bb 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2382,7 +2382,7 @@ _git_show_branch ()
 
 _git_stash ()
 {
-	local save_opts='--keep-index --no-keep-index --quiet --patch'
+	local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked'
 	local subcommands='save list show apply clear drop pop create branch'
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
 	if [ -z "$subcommand" ]; then
@@ -2404,9 +2404,20 @@ _git_stash ()
 		apply,--*|pop,--*)
 			__gitcomp "--index --quiet"
 			;;
-		show,--*|drop,--*|branch,--*)
+		drop,--*)
+			__gitcomp "--quiet"
 			;;
-		show,*|apply,*|drop,*|pop,*|branch,*)
+		show,--*|branch,--*)
+			;;
+		branch,*)
+			if [ $cword -eq 3 ]; then
+			__gitcomp_nl "$(__git_refs)";
+			else
+				__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
+						| sed -n -e 's/:.*//p')"
+			fi
+			;;
+		show,*|apply,*|drop,*|pop,*)
 			__gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \
 					| sed -n -e 's/:.*//p')"
 			;;
-- 
2.7.0
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 10 in “Update BASH completions”
  1. 0/2 Update BASH completionsPaul Wagland, Jan 23, 2016
  2. PATCH 1/2] Update the flags for git show-branchPaul Wagland, Jan 23, 2016
  3. Junio C HamanoJan 25, 2016
  4. 2/2 Fix up the arguments for git stash.Paul Wagland, Jan 23, 2016
  5. Junio C HamanoJan 25, 2016
  6. Paul WaglandJan 26, 2016
  7. 0/2 Update BASH completionsPaul Wagland, Jan 26, 2016
  8. 1/2 completion: complete show-branch "--date-order"Paul Wagland, Jan 26, 2016
  9. 2/4 completion: update completion arguments for stashPaul Wagland, Jan 26, 2016
  10. completion: fix mis-indentation in _git_stash()SZEDER Gábor, Feb 22, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.