git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] mergetool-lib: make (g)vimdiff workable under Windows

From
Markus Heidelberg <markus.heidelberg@web.de>
Date
Apr 4, 2009, 13:17 UTC
Message-ID
<200904041517.55890.markus.heidelberg@web.de>

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>
---

This patch goes on top of the current difftool/mergetool patches from David. This is 'da/difftool' in the current 'pu' and in addition: [PATCH] mergetool-lib: refactor run_mergetool and check_unchanged [PATCH] mergetool-lib: specialize opendiff options when in diff mode

 git-mergetool--lib.sh |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index b8566b2..6f0e8f7 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -11,6 +11,12 @@ get_merge_tool_path () {
 	path="$1"
 	if test -z "$2"; then
 		case "$1" in
+		vimdiff)
+			path=vim
+			;;
+		gvimdiff)
+			path=gvim
+			;;
 		emerge)
 			path=emacs
 			;;
@@ -142,19 +148,19 @@ run_mergetool () {
 	vimdiff)
 		if merge_mode; then
 			touch "$BACKUP"
-			"$merge_tool_path" -c "wincmd l" "$LOCAL" "$MERGED" "$REMOTE"
+			"$merge_tool_path" -d -c "wincmd l" "$LOCAL" "$MERGED" "$REMOTE"
 			check_unchanged
 		else
-			"$merge_tool_path" -c "wincmd l" "$LOCAL" "$REMOTE"
+			"$merge_tool_path" -d -c "wincmd l" "$LOCAL" "$REMOTE"
 		fi
 		;;
 	gvimdiff)
 		if merge_mode; then
 			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
 		else
-			"$merge_tool_path" -c "wincmd l" -f "$LOCAL" "$REMOTE"
+			"$merge_tool_path" -d -c "wincmd l" -f "$LOCAL" "$REMOTE"
 		fi
 		;;
 	xxdiff)
-- 
1.6.2.2.428.gea44ab
Next: Johannes Schindelin
Message 1 of 4 in “mergetool-lib: make (g)vimdiff workable under Windows”
  1. mergetool-lib: make (g)vimdiff workable under WindowsMarkus Heidelberg, Apr 4, 2009
  2. Johannes SchindelinApr 5, 2009
  3. Markus HeidelbergApr 5, 2009
  4. Junio C HamanoApr 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.