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

[PATCH v6 2/2] mergetools: add winmerge as a builtin tool

From
David Aguilar <davvid@gmail.com>
Date
May 20, 2015, 09:07 UTC
Message-ID
<1432112843-973-2-git-send-email-davvid@gmail.com>
In-Reply-To
<1432112843-973-1-git-send-email-davvid@gmail.com>

Add a winmerge scriptlet with the commands described in [1] so that users can use winmerge without needing to perform any additional configuration.

[1] http://thread.gmane.org/gmane.comp.version-control.git/268631
Helped-by: Philip Oakley <philipoakley@iee.org>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Helped-by: Sebastian Schuberth <sschuberth@gmail.com>
Helped-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Unchanged since v5.
Changes since v4: IFS is left as-is since it's done in 1/2
 mergetools/winmerge | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 mergetools/winmerge
diff --git a/mergetools/winmerge b/mergetools/winmerge
new file mode 100644
index 0000000..74a66d4
--- /dev/null
+++ b/mergetools/winmerge
@@ -0,0 +1,36 @@
+diff_cmd () {
+	"$merge_tool_path" -u -e "$LOCAL" "$REMOTE"
+	return 0
+}
+
+merge_cmd () {
+	# mergetool.winmerge.trustExitCode is implicitly false.
+	# touch $BACKUP so that we can check_unchanged.
+	touch "$BACKUP"
+	"$merge_tool_path" -u -e -dl Local -dr Remote \
+		"$LOCAL" "$REMOTE" "$MERGED"
+	check_unchanged
+}
+
+translate_merge_tool_path() {
+	# Use WinMergeU.exe if it exists in $PATH
+	if type -p WinMergeU.exe >/dev/null 2>&1
+	then
+		printf WinMergeU.exe
+		return
+	fi
+
+	# Look for WinMergeU.exe in the typical locations
+	winmerge_exe="WinMerge/WinMergeU.exe"
+	for directory in $(env | grep -Ei '^PROGRAM(FILES(\(X86\))?|W6432)=' |
+		cut -d '=' -f 2- | sort -u)
+	do
+		if test -n "$directory" && test -x "$directory/$winmerge_exe"
+		then
+			printf '%s' "$directory/$winmerge_exe"
+			return
+		fi
+	done
+
+	printf WinMergeU.exe
+}
-- 
2.4.1.218.gc09a0e5
Previous: David AguilarNext: SZEDER Gábor
Message 2 of 11 in “mergetool--lib: set IFS for difftool and mergetool”
  1. 1/2 mergetool--lib: set IFS for difftool and mergetoolDavid Aguilar, May 20, 2015
  2. 2/2 mergetools: add winmerge as a builtin toolDavid Aguilar, May 20, 2015
  3. SZEDER GáborMay 20, 2015
  4. David AguilarMay 22, 2015
  5. Junio C HamanoMay 22, 2015
  6. David AguilarMay 22, 2015
  7. Junio C HamanoMay 20, 2015
  8. Sebastian SchuberthMay 20, 2015
  9. Junio C HamanoMay 20, 2015
  10. Sebastian SchuberthMay 20, 2015
  11. Johannes SchindelinMay 21, 2015

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.