mirror of
https://github.com/git/git.git
synced 2024-11-01 23:07:55 +01:00
b12d04503b
Older versions of meld listed --output in `meld --help`. Newer versions only mention `meld [OPTIONS...]`. Improve the checks to catch these newer versions. Add a `mergetool.meld.hasOutput` configuration to allow overriding the heuristic. Reported-by: Andrey Novoseltsev <novoselt@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
37 lines
876 B
Text
37 lines
876 B
Text
diff_cmd () {
|
|
"$merge_tool_path" "$LOCAL" "$REMOTE"
|
|
}
|
|
|
|
merge_cmd () {
|
|
if test -z "${meld_has_output_option:+set}"
|
|
then
|
|
check_meld_for_output_version
|
|
fi
|
|
touch "$BACKUP"
|
|
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_unchanged
|
|
}
|
|
|
|
# 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
|
|
}
|