All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: David Aguilar <davvid@gmail.com>
Cc: git@vger.kernel.org, Andrey Novoseltsev <novoselt@gmail.com>
Subject: Re: [PATCH] mergetools/meld: do not rely on the output of `meld --help`
Date: Wed, 15 Oct 2014 12:18:54 -0700	[thread overview]
Message-ID: <xmqqh9z5w38h.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqoatdw3wk.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Wed, 15 Oct 2014 12:04:27 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> This obviously breaks those who have happily been using their
> installed version of meld that understands and shows --output in the
> help text.  Is that a minority that is rapidly diminishing?
>
> I would understand it if the change were
>
>  - a configuration tells us to use or not use --output; when it is
>    set, then we do not try auto-detect by reading --help output
>
>  - when that new configuration is not set, we keep the current code
>    to read --help output, which may fail for recent meld but that is
>    not a regression.
>
> When versions of meld that support --output but do not mention it in
> their --help text are overwhelming majority, we would want to flip
> the fallback codepath from "read --help and decide" to "assume that
> --output can be used", but I do not know if now is the time to do
> so.

In other words, I am wondering if a milder fix would be along this
line of change instead.  Older versions seem to list --output
explicitly, and we assume newer ones including the one reported by
Andrey begin their output like so:

    $ meld --help
    Usage:
      meld [OPTION...]

hence we catch either of these patterns.

 mergetools/meld | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mergetools/meld b/mergetools/meld
index cb672a5..b6169c9 100644
--- a/mergetools/meld
+++ b/mergetools/meld
@@ -23,8 +23,12 @@ 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 meld_has_output_option="$(git config --bool mergetool.meld.hasOutput)"
 	then
+		: use whatever is configured
+	elif "$meld_path" --help 2>&1 | grep -e '--output=' -e '\[OPTION\.\.\.\]' /dev/null
+	then
+		: old ones explicitly listed --output and new ones just say OPTION...
 		meld_has_output_option=true
 	else
 		meld_has_output_option=false

  reply	other threads:[~2014-10-15 19:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-10-16  4:45     ` [PATCH v2] mergetools/meld: make usage of `--output` configurable and more robust David Aguilar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqh9z5w38h.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=novoselt@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.