Code

git-mergetool/difftool: make (g)vimdiff workable under Windows
authorMarkus Heidelberg <markus.heidelberg@web.de>
Mon, 6 Apr 2009 08:31:17 +0000 (01:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Apr 2009 05:19:55 +0000 (22:19 -0700)
Under Windows vimdiff and gvimdiff are not available as symbolic links,
but as batch files vimdiff.bat and gvimdiff.bat. These files weren't
found by 'type vimdiff' which led to the following error:

    The merge tool vimdiff is not available as 'vimdiff'

Even if they were found, it wouldn't work to invoke these batch files
from git-mergetool.

To solve this, use vim and gvim (vim.exe and gvim.exe) and pass the -d
command line switch over to them.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/difftool/git-difftool-helper
git-mergetool.sh

index 9c0a13452a60059b504f07cb94a3cc16e1a2e6e7..e481913c91c83a19c5e10db1f66949c60d24b4f1 100755 (executable)
@@ -86,11 +86,11 @@ launch_merge_tool () {
                ;;
 
        vimdiff)
-               "$merge_tool_path" -c "wincmd l" "$LOCAL" "$REMOTE"
+               "$merge_tool_path" -d -c "wincmd l" "$LOCAL" "$REMOTE"
                ;;
 
        gvimdiff)
-               "$merge_tool_path" -c "wincmd l" -f "$LOCAL" "$REMOTE"
+               "$merge_tool_path" -d -c "wincmd l" -f "$LOCAL" "$REMOTE"
                ;;
 
        xxdiff)
@@ -160,6 +160,12 @@ init_merge_tool_path() {
        merge_tool_path=$(git config mergetool."$1".path)
        if test -z "$merge_tool_path"; then
                case "$1" in
+               vimdiff)
+                       merge_tool_path=vim
+                       ;;
+               gvimdiff)
+                       merge_tool_path=gvim
+                       ;;
                emerge)
                        merge_tool_path=emacs
                        ;;
index 87fa88af5526c8e27b823a65ca15bee4085f8ef2..6e611e94a467ba3b3e1f56624807e231e865bce7 100755 (executable)
@@ -214,12 +214,12 @@ merge_file () {
            ;;
        vimdiff)
            touch "$BACKUP"
-           "$merge_tool_path" -c "wincmd l" "$LOCAL" "$MERGED" "$REMOTE"
+           "$merge_tool_path" -d -c "wincmd l" "$LOCAL" "$MERGED" "$REMOTE"
            check_unchanged
            ;;
        gvimdiff)
            touch "$BACKUP"
-           "$merge_tool_path" -c "wincmd l" -f "$LOCAL" "$MERGED" "$REMOTE"
+           "$merge_tool_path" -d -c "wincmd l" -f "$LOCAL" "$MERGED" "$REMOTE"
            check_unchanged
            ;;
        xxdiff)
@@ -359,6 +359,12 @@ init_merge_tool_path() {
        merge_tool_path=`git config mergetool.$1.path`
        if test -z "$merge_tool_path" ; then
                case "$1" in
+                       vimdiff)
+                               merge_tool_path=vim
+                               ;;
+                       gvimdiff)
+                               merge_tool_path=gvim
+                               ;;
                        emerge)
                                merge_tool_path=emacs
                                ;;