Merge branch 'js/t3404-grammo-fix'
[git] / mergetools / meld
1 diff_cmd () {
2         "$merge_tool_path" "$LOCAL" "$REMOTE"
3 }
4
5 merge_cmd () {
6         if test -z "${meld_has_output_option:+set}"
7         then
8                 check_meld_for_output_version
9         fi
10         touch "$BACKUP"
11         if test "$meld_has_output_option" = true
12         then
13                 "$merge_tool_path" --output "$MERGED" \
14                         "$LOCAL" "$BASE" "$REMOTE"
15         else
16                 "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
17         fi
18         check_unchanged
19 }
20
21 # Check whether we should use 'meld --output <file>'
22 check_meld_for_output_version () {
23         meld_path="$(git config mergetool.meld.path)"
24         meld_path="${meld_path:-meld}"
25
26         if meld_has_output_option=$(git config --bool mergetool.meld.hasOutput)
27         then
28                 : use configured value
29         elif "$meld_path" --help 2>&1 |
30                 grep -e '--output=' -e '\[OPTION\.\.\.\]' >/dev/null
31         then
32                 : old ones mention --output and new ones just say OPTION...
33                 meld_has_output_option=true
34         else
35                 meld_has_output_option=false
36         fi
37 }