git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "git difftool" is not working as expected during MERGING
@ 2015-06-10 13:12 Bossert, Andre
  2015-06-11  9:22 ` David Aguilar
  0 siblings, 1 reply; 2+ messages in thread
From: Bossert, Andre @ 2015-06-10 13:12 UTC (permalink / raw)
  To: git

Hello,

i've tested "git difftool" with -t --ext-cmd and other options to see
my diff with external tools, but it always show internal text-diff in
console. The same tests with "git mergetool" working as expected. I've
compared (nanually reviewed) git-mergetool.sh with git-difftool.pl and
see that difftool is mixed / shared implementation with normal "git
diff" command. So during MERGING state there is no possibility to call
external difftool with this command. Any ideas why this was
implemented this way?

-- 
Regards
Andre (anb0s)
eMail: anb0s@anbos.de

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

* Re: "git difftool" is not working as expected during MERGING
  2015-06-10 13:12 "git difftool" is not working as expected during MERGING Bossert, Andre
@ 2015-06-11  9:22 ` David Aguilar
  0 siblings, 0 replies; 2+ messages in thread
From: David Aguilar @ 2015-06-11  9:22 UTC (permalink / raw)
  To: Bossert, Andre; +Cc: git

On Wed, Jun 10, 2015 at 03:12:21PM +0200, Bossert, Andre wrote:
> Hello,
> 
> i've tested "git difftool" with -t --ext-cmd and other options to see
> my diff with external tools, but it always show internal text-diff in
> console. The same tests with "git mergetool" working as expected. I've
> compared (nanually reviewed) git-mergetool.sh with git-difftool.pl and
> see that difftool is mixed / shared implementation with normal "git
> diff" command. So during MERGING state there is no possibility to call
> external difftool with this command. Any ideas why this was
> implemented this way?
> 
> -- 
> Regards
> Andre (anb0s)
> eMail: anb0s@anbos.de

The "why" behind this behavior is likely, "historical reasons".

The behavior you described is an unfortunate side-effect of how
it's implemented under the hood.  As you discovered, difftool is
built upon git-diff's GIT_EXTERNAL_DIFF feature.

That feature is not invoked when the index contains multiple
stages (i.e. when merging) and the combined diff is printed
instead.

A logical extension to the GIT_EXTERNAL_DIFF machinery might be
something like supporting a GIT_EXTERNAL_MERGE_DIFF variable to
handle the 3-way case.  We could then plug this edge case by
creating a new handler that reuses the mergetool code[1].

Alternatively, we could make "git diff" stricter and teaach it
to die() when doing a mergy diff and GIT_EXTERNAL_DIFF is set.
That might break existing setups, though, so having a new
feature does seem preferable over making it stricter.

As you mentioned, using "git mergetool" works.  That's because
mergetool is the intended tool for that use case.  The fact that
difftool prints a combined diff when when your worktree is in
the middle of a conflicted merge is simply an unpolished edge
case.

If you've already resolved all of your conflicts, and everything
is staged, then "git difftool --staged" will work too.

Let me know if you have any questions.  If you're interested in
implementing the idea described in [1] then I'd be happy to help
review and test the code, but for now you can probably just use
"git mergetool".

cheers,
-- 
David

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

end of thread, other threads:[~2015-06-11  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 13:12 "git difftool" is not working as expected during MERGING Bossert, Andre
2015-06-11  9:22 ` David Aguilar

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 NNTP newsgroup(s).