Skip to content

Commit 3e4f237

Browse files
davvidgitster
authored andcommitted
mergetools: add winmerge as a builtin tool
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 <[email protected]> Helped-by: Johannes Schindelin <[email protected]> Helped-by: Sebastian Schuberth <[email protected]> Helped-by: SZEDER Gábor <[email protected]> Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 719518f commit 3e4f237

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

mergetools/winmerge

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff_cmd () {
2+
"$merge_tool_path" -u -e "$LOCAL" "$REMOTE"
3+
return 0
4+
}
5+
6+
merge_cmd () {
7+
# mergetool.winmerge.trustExitCode is implicitly false.
8+
# touch $BACKUP so that we can check_unchanged.
9+
touch "$BACKUP"
10+
"$merge_tool_path" -u -e -dl Local -dr Remote \
11+
"$LOCAL" "$REMOTE" "$MERGED"
12+
check_unchanged
13+
}
14+
15+
translate_merge_tool_path() {
16+
# Use WinMergeU.exe if it exists in $PATH
17+
if type -p WinMergeU.exe >/dev/null 2>&1
18+
then
19+
printf WinMergeU.exe
20+
return
21+
fi
22+
23+
# Look for WinMergeU.exe in the typical locations
24+
winmerge_exe="WinMerge/WinMergeU.exe"
25+
for directory in $(env | grep -Ei '^PROGRAM(FILES(\(X86\))?|W6432)=' |
26+
cut -d '=' -f 2- | sort -u)
27+
do
28+
if test -n "$directory" && test -x "$directory/$winmerge_exe"
29+
then
30+
printf '%s' "$directory/$winmerge_exe"
31+
return
32+
fi
33+
done
34+
35+
printf WinMergeU.exe
36+
}

0 commit comments

Comments
 (0)