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>
Shawn O. Pearce committed
Nov 5, 2006 at 06:24 UTC
e5d5b21fdf0ec0aebbfaca814a15d15a718544a2
1 file changed
+8
-3
contrib/completion/git-completion.bash
+8
-3
@@ -222,11 +222,16 @@ _git_ls_tree ()
222
223
_git_log ()
224
{
225
- local cur="${COMP_WORDS[COMP_CWORD]}"
225
+ local pfx cur="${COMP_WORDS[COMP_CWORD]}"
226
case "$cur" in
227
+ *...*)
228
+ pfx="${cur%...*}..."
229
+ cur="${cur#*...}"
230
+ COMPREPLY=($(compgen -P "$pfx" -W "$(__git_refs)" -- "$cur"))
231
+ ;;
232
*..*)
228
- local pfx=$(echo "$cur" | sed 's/\.\..*$/../')
229
- cur=$(echo "$cur" | sed 's/^.*\.\.//')
233
+ pfx="${cur%..*}.."
234
+ cur="${cur#*..}"
235
COMPREPLY=($(compgen -P "$pfx" -W "$(__git_refs)" -- "$cur"))
236
;;
237
*)