2 "$merge_tool_path" "$LOCAL" "$REMOTE"
6 echo "Use Meld (requires a graphical session)"
10 check_meld_for_features
13 if test "$meld_use_auto_merge_option" = true
15 option_auto_merge="--auto-merge"
18 if test "$meld_has_output_option" = true
20 "$merge_tool_path" $option_auto_merge --output="$MERGED" \
21 "$LOCAL" "$BASE" "$REMOTE"
23 "$merge_tool_path" $option_auto_merge "$LOCAL" "$MERGED" "$REMOTE"
28 echo "Use Meld (requires a graphical session) with optional \`auto merge\` (see \`git help mergetool\`'s \`CONFIGURATION\` section)"
31 # Get meld help message
32 init_meld_help_msg () {
33 if test -z "$meld_help_msg"
35 meld_path="$(git config mergetool.meld.path || echo meld)"
36 meld_help_msg=$("$meld_path" --help 2>&1)
40 # Check the features and set flags
41 check_meld_for_features () {
42 # Check whether we should use 'meld --output <file>'
43 if test -z "$meld_has_output_option"
45 meld_has_output_option=$(git config --bool mergetool.meld.hasOutput)
46 case "$meld_has_output_option" in
48 : use configured value
51 : empty or invalid configured value, detecting "--output" automatically
54 case "$meld_help_msg" in
55 *"--output="* | *'[OPTION...]'*)
56 # All version that has [OPTION...] supports --output
57 meld_has_output_option=true
60 meld_has_output_option=false
66 # Check whether we should use 'meld --auto-merge ...'
67 if test -z "$meld_use_auto_merge_option"
69 meld_use_auto_merge_option=$(
70 git config --bool-or-str mergetool.meld.useAutoMerge
72 case "$meld_use_auto_merge_option" in
74 : use well formatted boolean value
77 # testing the "--auto-merge" option only if config is "auto"
80 case "$meld_help_msg" in
81 *"--auto-merge"* | *'[OPTION...]'*)
82 meld_use_auto_merge_option=true
85 meld_use_auto_merge_option=false
90 meld_use_auto_merge_option=false
93 die "unknown mergetool.meld.useAutoMerge: $meld_use_auto_merge_option"