Skip to content

Commit 9db1838

Browse files
committed
Merge branch 'da/mergetool-meld' into maint
* da/mergetool-meld: mergetools/meld: make usage of `--output` configurable and more robust
2 parents af1b4e3 + b12d045 commit 9db1838

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Documentation/config.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,15 @@ mergetool.<tool>.trustExitCode::
17541754
if the file has been updated, otherwise the user is prompted to
17551755
indicate the success of the merge.
17561756

1757+
mergetool.meld.hasOutput::
1758+
Older versions of `meld` do not support the `--output` option.
1759+
Git will attempt to detect whether `meld` supports `--output`
1760+
by inspecting the output of `meld --help`. Configuring
1761+
`mergetool.meld.hasOutput` will make Git skip these checks and
1762+
use the configured value instead. Setting `mergetool.meld.hasOutput`
1763+
to `true` tells Git to unconditionally use the `--output` option,
1764+
and `false` avoids using `--output`.
1765+
17571766
mergetool.keepBackup::
17581767
After performing a merge, the original file with conflict markers
17591768
can be saved as a file with a `.orig` extension. If this variable

mergetools/meld

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ merge_cmd () {
1818
check_unchanged
1919
}
2020

21-
# Check whether 'meld --output <file>' is supported
21+
# Check whether we should use 'meld --output <file>'
2222
check_meld_for_output_version () {
2323
meld_path="$(git config mergetool.meld.path)"
2424
meld_path="${meld_path:-meld}"
2525

26-
if "$meld_path" --help 2>&1 | grep -e --output >/dev/null
26+
if meld_has_output_option=$(git config --bool mergetool.meld.hasOutput)
2727
then
28+
: use configured value
29+
elif "$meld_path" --help 2>&1 |
30+
grep -e '--output=' -e '\[OPTION\.\.\.\]' >/dev/null
31+
then
32+
: old ones mention --output and new ones just say OPTION...
2833
meld_has_output_option=true
2934
else
3035
meld_has_output_option=false

0 commit comments

Comments
 (0)