git-commit-vandalism/mergetools/meld
David Aguilar 0af85f84bd mergetools/meld: improve compatibiilty with Meld on macOS X
The macOS X fork of Meld[1] requires a "=" in the "--output"
argument, as it uses a wrapper[2] script that munges the
"--output" argument before calling into the common "meld"
script.

The macOS X wrapper script[2] accepts "--output=<filename>"
only, despite the fact that the underlying meld code accepts
both "--output <filename" and "--output=<filename>"[3].

All versions of meld which accept "--output" accept it in
the "--output=<filename>" form, so use "--output=<file>" for
maximum compatibility.

[1] https://github.com/yousseb/meld
[2] https://github.com/yousseb/meld/blob/master/osx/Meld
[3] https://github.com/yousseb/meld/issues/42

Reported-by: Matthew Groth <mgroth49@gmail.com>
Helped-by: Samuel Lijin <sxlijin@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-18 22:11:29 -07:00

37 lines
843 B
Plaintext

diff_cmd () {
"$merge_tool_path" "$LOCAL" "$REMOTE"
}
merge_cmd () {
if test -z "${meld_has_output_option:+set}"
then
check_meld_for_output_version
fi
if test "$meld_has_output_option" = true
then
"$merge_tool_path" --output="$MERGED" \
"$LOCAL" "$BASE" "$REMOTE"
else
"$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
fi
}
# Check whether we should use 'meld --output <file>'
check_meld_for_output_version () {
meld_path="$(git config mergetool.meld.path)"
meld_path="${meld_path:-meld}"
if meld_has_output_option=$(git config --bool mergetool.meld.hasOutput)
then
: 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...
meld_has_output_option=true
else
meld_has_output_option=false
fi
}