bash completion: difftool accepts the same options as diff
authorMarkus Heidelberg <markus.heidelberg@web.de>
Wed, 28 Oct 2009 09:45:38 +0000 (10:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Oct 2009 17:59:40 +0000 (10:59 -0700)
So complete refs, files after the double-dash and some diff options that
make sense for difftool.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash

index 7c7318c43679a95d05f4192304022cef8eb246ea..e3ddecc995eb30391639983d9f6f0db7567d7b9a 100755 (executable)
@@ -958,6 +958,8 @@ __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff
 
 _git_difftool ()
 {
+       __git_has_doubledash && return
+
        local cur="${COMP_WORDS[COMP_CWORD]}"
        case "$cur" in
        --tool=*)
@@ -965,11 +967,15 @@ _git_difftool ()
                return
                ;;
        --*)
-               __gitcomp "--tool="
+               __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex
+                       --base --ours --theirs
+                       --no-renames --diff-filter= --find-copies-harder
+                       --relative --ignore-submodules
+                       --tool="
                return
                ;;
        esac
-       COMPREPLY=()
+       __git_complete_file
 }
 
 __git_fetch_options="