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

[PATCH] bash: support 'git notes' and its subcommands

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Jan 28, 2010, 01:05 UTC
Message-ID
<1264640755-22447-1-git-send-email-szeder@ira.uka.de>

... and it will offer refs unless after -m or -F, because these two options require a non-ref argument.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9651720..8b56c34 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1306,6 +1306,24 @@ _git_name_rev ()
 	__gitcomp "--tags --all --stdin"
 }
 
+_git_notes ()
+{
+	local subcommands="edit show"
+	if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then
+		__gitcomp "$subcommands"
+		return
+	fi
+
+	case "${COMP_WORDS[COMP_CWORD-1]}" in
+	-m|-F)
+		COMPREPLY=()
+		;;
+	*)
+		__gitcomp "$(__git_refs)"
+		;;
+	esac
+}
+
 _git_pull ()
 {
 	__git_complete_strategy && return
@@ -2218,6 +2236,7 @@ _git ()
 	merge-base)  _git_merge_base ;;
 	mv)          _git_mv ;;
 	name-rev)    _git_name_rev ;;
+	notes)       _git_notes ;;
 	pull)        _git_pull ;;
 	push)        _git_push ;;
 	rebase)      _git_rebase ;;
-- 
1.7.0.rc0.28.g3ad3d5
Next: Shawn O. Pearce
Message 1 of 5 in “bash: support 'git notes' and its subcommands”
  1. bash: support 'git notes' and its subcommandsSZEDER Gábor, Jan 28, 2010
  2. Shawn O. PearceJan 28, 2010
  3. Johan HerlandJan 28, 2010
  4. SZEDER GáborJan 28, 2010
  5. Johan HerlandJan 28, 2010

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.