All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mergetools/meld: do not rely on the output of `meld --help`
@ 2014-10-15  8:30 David Aguilar
  2014-10-15 19:04 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: David Aguilar @ 2014-10-15  8:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Andrey Novoseltsev

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-16  4:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-15  8:30 [PATCH] mergetools/meld: do not rely on the output of `meld --help` David Aguilar
2014-10-15 19:04 ` Junio C Hamano
2014-10-15 19:18   ` Junio C Hamano
2014-10-16  4:45     ` [PATCH v2] mergetools/meld: make usage of `--output` configurable and more robust David Aguilar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.