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