[PATCH] mergetools/meld: do not rely on the output of `meld --help`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We cannot rely on the output of `meld --help` when determining
whether or not meld understands the --output option.

Newer versions of meld print a generic help message that does not
mention --output even though it is supported.

Add a mergetool.meld.compat variable to enable the historical
behavior and make the --output mode the default.

Reported-by: Andrey Novoseltsev <novoselt@xxxxxxxxx>
Signed-off-by: David Aguilar <davvid@xxxxxxxxx>
---
 Documentation/config.txt | 7 +++++++
 mergetools/meld          | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 04a1e2f..a942bfe 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1755,6 +1755,13 @@ mergetool.<tool>.trustExitCode::
 	if the file has been updated, otherwise the user is prompted to
 	indicate the success of the merge.
 
+mergetool.meld.compat::
+	Git passes the `--output` option to `meld` by default when
+	using the `meld` merge tool.  Older versions of `meld` do not
+	understand the `--output` option.  Set `mergetool.meld.compat`
+	to `true` if your version of `meld` is older and does not
+	understand the `--output` option.  Defaults to false.
+
 mergetool.keepBackup::
 	After performing a merge, the original file with conflict markers
 	can be saved as a file with a `.orig` extension.  If this variable
diff --git a/mergetools/meld b/mergetools/meld
index cb672a5..9e2b8d2 100644
--- a/mergetools/meld
+++ b/mergetools/meld
@@ -18,12 +18,12 @@ merge_cmd () {
 	check_unchanged
 }
 
-# Check whether 'meld --output <file>' is supported
+# Use 'meld --output <file>' unless mergetool.meld.compat is true.
 check_meld_for_output_version () {
 	meld_path="$(git config mergetool.meld.path)"
 	meld_path="${meld_path:-meld}"
 
-	if "$meld_path" --help 2>&1 | grep -e --output >/dev/null
+	if test "$(git config --bool mergetool.meld.compat)" != true
 	then
 		meld_has_output_option=true
 	else
-- 
2.1.2.453.g1b015e3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]