From: Jeff King <peff@peff.net>
To: "Pugh, Logan" <Logan.Pugh@austintexas.gov>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
"liu.denton@gmail.com" <liu.denton@gmail.com>
Subject: Re: [2.22.0] difftool no longer passes through to git diff if diff.tool is unset
Date: Tue, 25 Jun 2019 17:35:45 -0400 [thread overview]
Message-ID: <20190625213545.GA23411@sigill.intra.peff.net> (raw)
In-Reply-To: <SN6PR09MB3248412C9E5AE197B65A8D878AE40@SN6PR09MB3248.namprd09.prod.outlook.com>
On Thu, Jun 20, 2019 at 07:29:36PM +0000, Pugh, Logan wrote:
> Thanks for the explanation. It sounds like I was under the incorrect
> assumption that I could use the difftool command the same way as the
> diff command. Part of my confusion could be blamed on the git-difftool
> documentation (https://git-scm.com/docs/git-difftool) which near the top
> states:
Well, it _is_ true that you can use it the same way. It's just that you
need to configure it to use whatever 3rd-party tool you want (and if you
do not want to configure a tool, then you are better off just using
git-diff directly). It was only due to a bug/historical accident that it
behaved just like git-diff in the no-index case (but not in the regular
case -- AFAICT, that would have been broken for your script always).
> My use case is a CLI program I've written that processes and then
> compares two arbitrary files using the git difftool apparatus as
> configured by the end user, leaving the choice to them whether to use
> the internal diff tool or an external tool.
>
> Now, if I'm understanding correctly, I should not rely on the behavior
> of git difftool --no-index passing through to git diff. I could add
> another CLI switch and code path to my program that calls git diff
> directly instead of git difftool but the passthrough behavior seemed
> more elegant at the time.
>
> Ideally, in my mind, git difftool should work as it says on the tin, as
> a straight up passthrough to git diff *unless* explicitly configured to
> use external tools (e.g. diff.tool and diff.guitool).
That does make some sense to me for your use case. But I'm worried it
would be a worse experience for people new to difftool (they run it and
scratch their heads why it does not do anything different, whereas now
they get walked through an interactive configuration).
I dunno. I do not use difftool myself, so I don't have strong opinions.
In the meantime, I think you can probably switch behavior in your script
by checking if the diff.tool config is set. It might be nice if difftool
had a better way to query that without you having to know if it's
configured. Or in your case I suppose even better would just be an
option like "--if-not-configured-just-use-regular-diff". Then it would
do what you want, without impacting users who do want the interactive
setup.
-Peff
next prev parent reply other threads:[~2019-06-25 21:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-19 23:54 [2.22.0] difftool no longer passes through to git diff if diff.tool is unset Pugh, Logan
2019-06-20 1:17 ` Denton Liu
2019-06-20 2:45 ` Denton Liu
2019-06-20 5:21 ` Jeff King
2019-06-20 19:29 ` Pugh, Logan
2019-06-25 21:35 ` Jeff King [this message]
2019-06-25 23:09 ` Pugh, Logan
2019-06-26 18:08 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190625213545.GA23411@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Logan.Pugh@austintexas.gov \
--cc=git@vger.kernel.org \
--cc=liu.denton@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).