Re: [2.22.0] difftool no longer passes through to git diff if diff.tool is unset

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

 



> On Wed, Jun 19, 2019 at 10:45:17PM -0400, Denton Liu wrote:
> 
>> Using the following command on git.git,
>> 
>> 	$ HOME=/dev/null ./git --exec-path=. difftool --no-index color.c color.h
>> 
>> I did a quick bisect on the issue and it seems like the cause of this
>> bug is actually 287ab28bfa (diff: reuse diff setup for --no-index case,
>> 2019-02-16). I'll do a bit more digging tomorrow.
> 
> I don't know much about how git-difftool works, but it looks like it
> sets GIT_EXTERNAL_DIFF=git-difftool--helper.
> 
> Prior to 287ab28bfa, we would not have respected any external diff
> command when running git-diff. But after it, we do.
> 
> In the case that he user has not provided --no-index, then this all
> works as I guess difftool is meant to: it runs the helper and says "hey,
> you have not configured this".
> 
> It seems like the behavior of the above command prior to 287ab28bfa was
> not intentional. It would run git-diff, expecting it to trigger the
> helper, but it never did (and instead just did a normal no-index diff).
> 
> So it seems like the new behavior is actually the right thing, as it
> makes the --no-index case consistent with the regular one? I'm not
> at all clear why you would run "difftool" here if you it is not
> configured and you just want the straight diff output.
> 
> -Peff


Hi Peff,

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:

 > git difftool is a frontend to git diff and accepts the same options 
and arguments. See git-diff[1].

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).

Hopefully that makes sense, please let me know if I am off-base.

Thanks,

Logan




[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]

  Powered by Linux