From 3e4f2373b295e19dbc1a6bd0e743f65b500b7bda Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Wed, 20 May 2015 02:07:23 -0700 Subject: mergetools: add winmerge as a builtin tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Helped-by: Johannes Schindelin Helped-by: Sebastian Schuberth Helped-by: SZEDER Gábor Signed-off-by: David Aguilar Signed-off-by: Junio C Hamano --- mergetools/winmerge | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 mergetools/winmerge (limited to 'mergetools') diff --git a/mergetools/winmerge b/mergetools/winmerge new file mode 100644 index 0000000000..74a66d4e8d --- /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 +} -- cgit v1.2.3