2011-08-18 09:23:46 +02:00
|
|
|
diff_cmd () {
|
|
|
|
"$merge_tool_path" "$LOCAL" "$REMOTE"
|
|
|
|
}
|
|
|
|
|
2022-03-30 21:19:09 +02:00
|
|
|
diff_cmd_help () {
|
|
|
|
echo "Use Meld (requires a graphical session)"
|
|
|
|
}
|
|
|
|
|
2011-08-18 09:23:46 +02:00
|
|
|
merge_cmd () {
|
2020-05-07 01:31:14 +02:00
|
|
|
check_meld_for_features
|
|
|
|
|
|
|
|
option_auto_merge=
|
|
|
|
if test "$meld_use_auto_merge_option" = true
|
2011-08-19 11:14:45 +02:00
|
|
|
then
|
2020-05-07 01:31:14 +02:00
|
|
|
option_auto_merge="--auto-merge"
|
2011-08-19 11:14:45 +02:00
|
|
|
fi
|
2016-11-29 10:38:07 +01:00
|
|
|
|
2011-08-19 11:14:45 +02:00
|
|
|
if test "$meld_has_output_option" = true
|
|
|
|
then
|
2020-05-07 01:31:14 +02:00
|
|
|
"$merge_tool_path" $option_auto_merge --output="$MERGED" \
|
2011-08-19 11:14:45 +02:00
|
|
|
"$LOCAL" "$BASE" "$REMOTE"
|
|
|
|
else
|
2020-05-07 01:31:14 +02:00
|
|
|
"$merge_tool_path" $option_auto_merge "$LOCAL" "$MERGED" "$REMOTE"
|
2011-08-19 11:14:45 +02:00
|
|
|
fi
|
2011-08-18 09:23:46 +02:00
|
|
|
}
|
2011-08-19 11:14:45 +02:00
|
|
|
|
2022-03-30 21:19:09 +02:00
|
|
|
merge_cmd_help () {
|
|
|
|
echo "Use Meld (requires a graphical session) with optional \`auto merge\` (see \`git help mergetool\`'s \`CONFIGURATION\` section)"
|
|
|
|
}
|
|
|
|
|
2020-05-07 01:31:14 +02:00
|
|
|
# Get meld help message
|
|
|
|
init_meld_help_msg () {
|
|
|
|
if test -z "$meld_help_msg"
|
|
|
|
then
|
|
|
|
meld_path="$(git config mergetool.meld.path || echo meld)"
|
|
|
|
meld_help_msg=$("$meld_path" --help 2>&1)
|
|
|
|
fi
|
|
|
|
}
|
2011-08-19 11:14:45 +02:00
|
|
|
|
2020-05-07 01:31:14 +02:00
|
|
|
# Check the features and set flags
|
|
|
|
check_meld_for_features () {
|
|
|
|
# Check whether we should use 'meld --output <file>'
|
|
|
|
if test -z "$meld_has_output_option"
|
2011-08-19 11:14:45 +02:00
|
|
|
then
|
2020-05-07 01:31:14 +02:00
|
|
|
meld_has_output_option=$(git config --bool mergetool.meld.hasOutput)
|
|
|
|
case "$meld_has_output_option" in
|
|
|
|
true | false)
|
|
|
|
: use configured value
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
: empty or invalid configured value, detecting "--output" automatically
|
|
|
|
init_meld_help_msg
|
|
|
|
|
|
|
|
case "$meld_help_msg" in
|
|
|
|
*"--output="* | *'[OPTION...]'*)
|
|
|
|
# All version that has [OPTION...] supports --output
|
|
|
|
meld_has_output_option=true
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
meld_has_output_option=false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
# Check whether we should use 'meld --auto-merge ...'
|
|
|
|
if test -z "$meld_use_auto_merge_option"
|
2014-10-16 06:45:14 +02:00
|
|
|
then
|
2020-05-07 01:31:14 +02:00
|
|
|
meld_use_auto_merge_option=$(
|
|
|
|
git config --bool-or-str mergetool.meld.useAutoMerge
|
|
|
|
)
|
|
|
|
case "$meld_use_auto_merge_option" in
|
|
|
|
true | false)
|
|
|
|
: use well formatted boolean value
|
|
|
|
;;
|
|
|
|
auto)
|
|
|
|
# testing the "--auto-merge" option only if config is "auto"
|
|
|
|
init_meld_help_msg
|
|
|
|
|
|
|
|
case "$meld_help_msg" in
|
|
|
|
*"--auto-merge"* | *'[OPTION...]'*)
|
|
|
|
meld_use_auto_merge_option=true
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
meld_use_auto_merge_option=false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
meld_use_auto_merge_option=false
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
die "unknown mergetool.meld.useAutoMerge: $meld_use_auto_merge_option"
|
|
|
|
;;
|
|
|
|
esac
|
2011-08-19 11:14:45 +02:00
|
|
|
fi
|
|
|
|
}
|