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

[PATCH v2 2/5] Completion: extract common stash listing code

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Oct 23, 2026, 13:20 UTC
Message-ID
<abf8efb792e6cc90db2752baaef4a7bb1d00f4b1.1792761643.git.ben.knoble@gmail.com>
In-Reply-To
<cover.1792761643.git.ben.knoble@gmail.com>

With no change in behavior, prepare to adjust how stashes are completed by centralizing candidate generation.

Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com>
---
 contrib/completion/git-completion.bash | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d60e85479c..697fef5462 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3593,20 +3593,23 @@ _git_stash ()
 		if [ $cword -eq $((__git_cmd_idx+2)) ]; then
 			__git_complete_refs
 		else
-			__gitcomp_nl "$(__git stash list \
-					| sed -n -e 's/:.*//p')"
+			__git_complete_stashes
 		fi
 		;;
 	import,*)
 		__git_complete_refs
 		;;
 	show,*|apply,*|drop,*|pop,*|export,*)
-		__gitcomp_nl "$(__git stash list \
-				| sed -n -e 's/:.*//p')"
+		__git_complete_stashes
 		;;
 	esac
 }
 
+__git_complete_stashes ()
+{
+	__gitcomp_nl "$(__git stash list | sed -n -e 's/:.*//p')"
+}
+
 _git_submodule ()
 {
 	__git_has_doubledash && return
-- 
2.56.0.237.g5414b88716.dirty
Previous: D. Ben KnobleNext: Junio C Hamano
Message 19 of 28 in “stash completion miscellany”
  1. 0/5 stash completion miscellanyD. Ben Knoble, Oct 12, 2026
  2. 1/5 completion: simplify stash subcommand completionD. Ben Knoble, Oct 12, 2026
  3. Patrick SteinhardtOct 16, 2026
  4. Ben KnobleOct 19, 2026
  5. 2/5 completion: extract common stash listing codeD. Ben Knoble, Oct 12, 2026
  6. 3/5 completion: fix Zsh handling of stash namesD. Ben Knoble, Oct 12, 2026
  7. Patrick SteinhardtOct 16, 2026
  8. Ben KnobleOct 19, 2026
  9. 4/5 doc: drop usage mentions of "git stash save"D. Ben Knoble, Oct 12, 2026
  10. Patrick SteinhardtOct 16, 2026
  11. 5/5 completion: drop "stash save" completion altogetherD. Ben Knoble, Oct 12, 2026
  12. Patrick SteinhardtOct 16, 2026
  13. Ben KnobleOct 19, 2026
  14. Patrick SteinhardtOct 20, 2026
  15. D. Ben KnobleOct 22, 2026
  16. Patrick SteinhardtOct 23, 2026
  17. 0/5 stash completion miscellanyD. Ben Knoble, Oct 23, 2026
  18. 1/5 completion: simplify stash subcommand completionD. Ben Knoble, Oct 23, 2026
  19. 2/5 Completion: extract common stash listing codeD. Ben Knoble, Oct 23, 2026
  20. Junio C HamanoOct 23, 2026
  21. 3/5 completion: fix Zsh handling of stash namesD. Ben Knoble, Oct 23, 2026
  22. 4/5 doc: drop usage mentions of "git stash save"D. Ben Knoble, Oct 23, 2026
  23. 5/5 completion: drop "stash save" completion altogetherD. Ben Knoble, Oct 23, 2026
  24. Junio C HamanoOct 23, 2026
  25. Ben KnobleOct 23, 2026
  26. Kristoffer HaugsbakkOct 23, 2026
  27. Patrick SteinhardtOct 26, 2026
  28. Junio C HamanoOct 26, 2026

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.