git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
David Aguilar <davvid@gmail.com>
Date
Oct 15, 2014, 08:30 UTC
Message-ID
<1413361848-16923-1-git-send-email-davvid@gmail.com>

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@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 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
Next: Junio C Hamano
Message 1 of 4 in “mergetools/meld: do not rely on the output of `meld --help`”
  1. mergetools/meld: do not rely on the output of `meld --help`David Aguilar, Oct 15, 2014
  2. Junio C HamanoOct 15, 2014
  3. Junio C HamanoOct 15, 2014
  4. mergetools/meld: make usage of `--output` configurable and more robustDavid Aguilar, Oct 16, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.