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

[PATCH] bash: Add completion for gitk --merge

From
RQRichard Quirk <richard.quirk@gmail.com>
Date
Apr 27, 2008, 15:35 UTC
Message-ID
<1209310510-7201-1-git-send-email-richard.quirk@gmail.com>
In-Reply-To
<20080427041816.GH29771@spearce.org>
Option is only completed when .git/MERGE_HEAD is present.
Signed-off-by: Richard Quirk <richard.quirk@gmail.com>
---
 contrib/completion/git-completion.bash |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 665a895..23db664 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1346,9 +1346,14 @@ _git ()
 _gitk ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
+	local g="$(git rev-parse --git-dir 2>/dev/null)"
+	local merge=""
+	if [ -f $g/MERGE_HEAD ]; then
+		merge="--merge"
+	fi
 	case "$cur" in
 	--*)
-		__gitcomp "--not --all"
+		__gitcomp "--not --all $merge"
 		return
 		;;
 	esac
-- 
1.5.5.1.79.g57cf
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 3 of 4 in “bash: Add completion for gitk --merge”
  1. bash: Add completion for gitk --mergeRichard Quirk, Apr 26, 2008
  2. Shawn O. PearceApr 27, 2008
  3. bash: Add completion for gitk --mergeRichard Quirk, Apr 27, 2008
  4. Shawn O. PearceApr 27, 2008

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.