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

[PATCH 5/6] Support bash completion on symmetric difference operator.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Nov 5, 2006, 11:24 UTC
Message-ID
<20061105112456.GE20495@spearce.org>

Now that log, whatchanged, rev-list, etc. support the symmetric difference operator '...' we should provide bash completion for it just like we do for '..'.

While we are at it we can remove two sed invocations during the interactive prompt and replace them with internal bash operations.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 contrib/completion/git-completion.bash |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f258f2f..74be651 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -222,11 +222,16 @@ _git_ls_tree ()
 
 _git_log ()
 {
-	local cur="${COMP_WORDS[COMP_CWORD]}"
+	local pfx cur="${COMP_WORDS[COMP_CWORD]}"
 	case "$cur" in
+	*...*)
+		pfx="${cur%...*}..."
+		cur="${cur#*...}"
+		COMPREPLY=($(compgen -P "$pfx" -W "$(__git_refs)" -- "$cur"))
+		;;
 	*..*)
-		local pfx=$(echo "$cur" | sed 's/\.\..*$/../')
-		cur=$(echo "$cur" | sed 's/^.*\.\.//')
+		pfx="${cur%..*}.."
+		cur="${cur#*..}"
 		COMPREPLY=($(compgen -P "$pfx" -W "$(__git_refs)" -- "$cur"))
 		;;
 	*)
-- 
1.4.3.3.g9621
Message 1 of 1 in “Support bash completion on symmetric difference operator.”
  1. 5/6 Support bash completion on symmetric difference operator.Shawn O. Pearce, Nov 5, 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.