@matheusbsbs / matheus-bagliano / commits / bad4273200
Fork 0

git-mergetool/difftool: make (g)vimdiff workable under Windows

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>

Markus Heidelberg committed Apr 6, 2009 at 01:31 UTC bad42732008cb0c1e77046d716e4446b1545d4d0
2 files changed +16 -4
contrib/difftool/git-difftool-helper
+8 -2
@@ -86,11 +86,11 @@ launch_merge_tool () {
86 ;;
87
88 vimdiff)
89 - "$merge_tool_path" -c "wincmd l" "$LOCAL" "$REMOTE"
89 + "$merge_tool_path" -d -c "wincmd l" "$LOCAL" "$REMOTE"
90 ;;
91
92 gvimdiff)
93 - "$merge_tool_path" -c "wincmd l" -f "$LOCAL" "$REMOTE"
93 + "$merge_tool_path" -d -c "wincmd l" -f "$LOCAL" "$REMOTE"
94 ;;
95
96 xxdiff)
@@ -160,6 +160,12 @@ init_merge_tool_path() {
160 merge_tool_path=$(git config mergetool."$1".path)
161 if test -z "$merge_tool_path"; then
162 case "$1" in
163 + vimdiff)
164 + merge_tool_path=vim
165 + ;;
166 + gvimdiff)
167 + merge_tool_path=gvim
168 + ;;
169 emerge)
170 merge_tool_path=emacs
171 ;;
git-mergetool.sh
+8 -2
@@ -214,12 +214,12 @@ merge_file () {
214 ;;
215 vimdiff)
216 touch "$BACKUP"
217 - "$merge_tool_path" -c "wincmd l" "$LOCAL" "$MERGED" "$REMOTE"
217 + "$merge_tool_path" -d -c "wincmd l" "$LOCAL" "$MERGED" "$REMOTE"
218 check_unchanged
219 ;;
220 gvimdiff)
221 touch "$BACKUP"
222 - "$merge_tool_path" -c "wincmd l" -f "$LOCAL" "$MERGED" "$REMOTE"
222 + "$merge_tool_path" -d -c "wincmd l" -f "$LOCAL" "$MERGED" "$REMOTE"
223 check_unchanged
224 ;;
225 xxdiff)
@@ -359,6 +359,12 @@ init_merge_tool_path() {
359 merge_tool_path=`git config mergetool.$1.path`
360 if test -z "$merge_tool_path" ; then
361 case "$1" in
362 + vimdiff)
363 + merge_tool_path=vim
364 + ;;
365 + gvimdiff)
366 + merge_tool_path=gvim
367 + ;;
368 emerge)
369 merge_tool_path=emacs
370 ;;