git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Suggestion for difftool behaviour during a merge conflict
@ 2013-03-13 18:48 Øystein Walle
  2013-03-13 22:26 ` David Aguilar
  0 siblings, 1 reply; 2+ messages in thread
From: Øystein Walle @ 2013-03-13 18:48 UTC (permalink / raw)
  To: git

When a merge is ongoing and there are conflicts, 'git difftool' will
output the exact same --cc-style diff output as 'git diff' will without
further explanation. This has lead to some confusion: A couple of weeks
ago a person asked on #git why his difftool wasn't working. After a long
while we realized difftool's behaviour after invocations such as 'git
difftool HEAD~ HEAD' would work as expected but 'git difftool' "simply
wouldn't".

With that in mind I have three suggestions on improving 'git difftool':

 - Show a three-way diff between the versions (local, remote, merge)
   using the user's configured difftool. Diffing against the version
   containing the markers will generate some extra noise in the difftool
   and might be confusing, but it's similar in behaviour to how 'git
   difftool' normally works.

 - Prompt the user if they want to launch 'git mergetool' instead since
   a merge is ongoing. Reasonable but it might be awkward if the user is
   asked whether the conflict was resolved or not when all they wanted
   to do was to visually diff something.

 - Add a notice to stderr saying that a --cc-style diff output is shown
   instead; or document the behaviour in the man page. Definitely the
   simplest option.

I'm willing to try to take a stab at either of these but I wanted to
bring it up first. There is of course an implicit fourth option which is
to do nothing, and that I'm wrong about this :)

Best regards,
Øystein Walle

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

* Re: Suggestion for difftool behaviour during a merge conflict
  2013-03-13 18:48 Suggestion for difftool behaviour during a merge conflict Øystein Walle
@ 2013-03-13 22:26 ` David Aguilar
  0 siblings, 0 replies; 2+ messages in thread
From: David Aguilar @ 2013-03-13 22:26 UTC (permalink / raw)
  To: Øystein Walle; +Cc: git

On Wed, Mar 13, 2013 at 11:48 AM, Øystein Walle <oystwa@gmail.com> wrote:
> When a merge is ongoing and there are conflicts, 'git difftool' will
> output the exact same --cc-style diff output as 'git diff' will without
> further explanation. This has lead to some confusion: A couple of weeks
> ago a person asked on #git why his difftool wasn't working. After a long
> while we realized difftool's behaviour after invocations such as 'git
> difftool HEAD~ HEAD' would work as expected but 'git difftool' "simply
> wouldn't".
>
> With that in mind I have three suggestions on improving 'git difftool':
>
>  - Show a three-way diff between the versions (local, remote, merge)
>    using the user's configured difftool. Diffing against the version
>    containing the markers will generate some extra noise in the difftool
>    and might be confusing, but it's similar in behaviour to how 'git
>    difftool' normally works.
>
>  - Prompt the user if they want to launch 'git mergetool' instead since
>    a merge is ongoing. Reasonable but it might be awkward if the user is
>    asked whether the conflict was resolved or not when all they wanted
>    to do was to visually diff something.
>
>  - Add a notice to stderr saying that a --cc-style diff output is shown
>    instead; or document the behaviour in the man page. Definitely the
>    simplest option.
>
> I'm willing to try to take a stab at either of these but I wanted to
> bring it up first. There is of course an implicit fourth option which is
> to do nothing, and that I'm wrong about this :)

Thanks for bringing this up.

I think the simplest first step would be to detect this state,
print a message saying that difftool cannot be used during a merge,
and suggest mergetool instead.

We would need to be careful to still allow difftool <ref> <ref>
and only trigger this behavior when the cc-style diff would be printed.

I have a feeling that this happens deep in git-diff.
git-difftool--helper is driven by git-diff via the
GIT_EXTERNAL_DIFF mechanism, and that mechanism is probably not
triggered when in this state, so we may need to add another
breadcrumb that we can build upon.

> Best regards,
> Øystein Walle

cheers,
-- 
David

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

end of thread, other threads:[~2013-03-13 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 18:48 Suggestion for difftool behaviour during a merge conflict Øystein Walle
2013-03-13 22:26 ` 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).