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

[PATCH 6/10] Teach bash how to complete git-cherry-pick.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Nov 27, 2006, 08:41 UTC
Message-ID
<20061127084159.GF19745@spearce.org>
In-Reply-To
<de7beb117fb963e68e1085b773593be326ffd495.1164616814.git.spearce@spearce.org>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 contrib/completion/git-completion.bash |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 729e5a9..02a60a0 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -269,6 +269,21 @@ _git_checkout ()
 	COMPREPLY=($(compgen -W "-l -b $(__git_refs)" -- "$cur"))
 }
 
+_git_cherry_pick ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--*)
+		COMPREPLY=($(compgen -W "
+			--edit --no-commit
+			" -- "$cur"))
+		;;
+	*)
+		COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
+		;;
+	esac
+}
+
 _git_diff ()
 {
 	__git_complete_file
@@ -472,6 +487,7 @@ _git ()
 	branch)      _git_branch ;;
 	cat-file)    _git_cat_file ;;
 	checkout)    _git_checkout ;;
+	cherry-pick) _git_cherry_pick ;;
 	diff)        _git_diff ;;
 	diff-tree)   _git_diff_tree ;;
 	fetch)       _git_fetch ;;
@@ -503,6 +519,7 @@ complete -o default            -F _gitk gitk
 complete -o default            -F _git_branch git-branch
 complete -o default -o nospace -F _git_cat_file git-cat-file
 complete -o default            -F _git_checkout git-checkout
+complete -o default            -F _git_cherry_pick git-cherry-pick
 complete -o default -o nospace -F _git_diff git-diff
 complete -o default            -F _git_diff_tree git-diff-tree
 complete -o default -o nospace -F _git_fetch git-fetch
-- 
1.4.4.1.ge3fb
Previous: Jakub NarebskiNext: Shawn O. Pearce
Message 7 of 19 in “Hide plumbing/transport commands from bash completion.”
  1. 2/10 Hide plumbing/transport commands from bash completion.Shawn O. Pearce, Nov 27, 2006
  2. 3/10 Teach bash how to complete options for git-name-rev.Shawn O. Pearce, Nov 27, 2006
  3. 4/10 Add current branch in PS1 support to git-completion.bash.Shawn O. Pearce, Nov 27, 2006
  4. SeanNov 27, 2006
  5. 5/10 Teach bash how to complete git-format-patch.Shawn O. Pearce, Nov 27, 2006
  6. Jakub NarebskiNov 27, 2006
  7. 6/10 Teach bash how to complete git-cherry-pick.Shawn O. Pearce, Nov 27, 2006
  8. 7/10 Teach bash how to complete git-rebase.Shawn O. Pearce, Nov 27, 2006
  9. 8/10 Teach bash about git log/show/whatchanged options.Shawn O. Pearce, Nov 27, 2006
  10. 9/10 Allow completion of --committer and --author arguments to git log.Shawn O. Pearce, Nov 27, 2006
  11. Nicolas VilzNov 27, 2006
  12. Shawn PearceNov 27, 2006
  13. Junio C HamanoNov 27, 2006
  14. Shawn PearceNov 27, 2006
  15. 10/10 Support bash completion of refs/remote.Shawn O. Pearce, Nov 27, 2006
  16. Shawn PearceNov 27, 2006
  17. SeanNov 27, 2006
  18. Shawn PearceNov 27, 2006
  19. SeanNov 27, 2006

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.