From: Shawn O. Pearce Date: Sun, 5 Nov 2006 11:24:56 +0000 (-0500) Subject: Support bash completion on symmetric difference operator. X-Git-Tag: v1.4.4-rc1~9 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e5d5b21fdf0ec0aebbfaca814a15d15a718544a2;p=git-core%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index f258f2f03..e4a32b61b 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")) ;; *)