Commits

Anonymous committed e5d5b21

Support bash completion on symmetric difference operator.

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>
Signed-off-by: Junio C Hamano <junkio@cox.net>

  • Participants
  • Parent commits 873537f

Comments (0)

Files changed (1)

File contrib/completion/git-completion.bash

 
 _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"))
 		;;
 	*)