Merge branch 'js/git-remote-add-url-insteadof-test'
[git] / mergetools / winmerge
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 }