2011-08-18 15:23:46 +08:00
|
|
|
diff_cmd () {
|
|
|
|
"$merge_tool_path" "$LOCAL" "$REMOTE"
|
|
|
|
}
|
|
|
|
|
|
|
|
merge_cmd () {
|
2011-08-19 17:14:45 +08:00
|
|
|
if test -z "${meld_has_output_option:+set}"
|
|
|
|
then
|
|
|
|
check_meld_for_output_version
|
|
|
|
fi
|
2016-11-29 17:38:07 +08:00
|
|
|
|
2011-08-19 17:14:45 +08:00
|
|
|
if test "$meld_has_output_option" = true
|
|
|
|
then
|
2017-06-19 10:10:33 +08:00
|
|
|
"$merge_tool_path" --output="$MERGED" \
|
2011-08-19 17:14:45 +08:00
|
|
|
"$LOCAL" "$BASE" "$REMOTE"
|
|
|
|
else
|
|
|
|
"$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
|
|
|
|
fi
|
2011-08-18 15:23:46 +08:00
|
|
|
}
|
2011-08-19 17:14:45 +08:00
|
|
|
|
2014-10-16 12:45:14 +08:00
|
|
|
# Check whether we should use 'meld --output <file>'
|
2011-08-19 17:14:45 +08:00
|
|
|
check_meld_for_output_version () {
|
|
|
|
meld_path="$(git config mergetool.meld.path)"
|
|
|
|
meld_path="${meld_path:-meld}"
|
|
|
|
|
2014-10-16 12:45:14 +08:00
|
|
|
if meld_has_output_option=$(git config --bool mergetool.meld.hasOutput)
|
2011-08-19 17:14:45 +08:00
|
|
|
then
|
2014-10-16 12:45:14 +08:00
|
|
|
: use configured value
|
|
|
|
elif "$meld_path" --help 2>&1 |
|
|
|
|
grep -e '--output=' -e '\[OPTION\.\.\.\]' >/dev/null
|
|
|
|
then
|
|
|
|
: old ones mention --output and new ones just say OPTION...
|
2011-08-19 17:14:45 +08:00
|
|
|
meld_has_output_option=true
|
|
|
|
else
|
|
|
|
meld_has_output_option=false
|
|
|
|
fi
|
|
|
|
}
|