From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Antoine Pelisse" <apelisse@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
git <git@vger.kernel.org>,
kernel@pengutronix.de
Subject: Re: feature suggestion: optimize common parts for checkout --conflict=diff3
Date: Thu, 4 Apr 2013 16:33:44 -0400 [thread overview]
Message-ID: <20130404203344.GA25330@sigill.intra.peff.net> (raw)
In-Reply-To: <20130307185046.GA11622@sigill.intra.peff.net>
On Thu, Mar 07, 2013 at 01:50:46PM -0500, Jeff King wrote:
> On Thu, Mar 07, 2013 at 10:40:46AM -0800, Junio C Hamano wrote:
>
> > Where we differ is if such information loss is a good thing to have.
> >
> > We could say "both sides added, identically" is auto-resolved when
> > you use the zealous option, and do so regardless of how the merge
> > conflicts are presented. Then it becomes perfectly fine to eject
> > "A" and "E" out of the conflicted block and merge them to be part of
> > pre/post contexts. The same goes for reducing "<C|=C>" to "C". As
> > long as we clearly present the users what the option does and what
> > its implications are, it is not bad to have such an option, I think.
>
> Exactly. I do think it has real-world uses (see the example script I
> posted yesterday), but it would never replace diff3. I'm going to try it
> out for a bit. As I mentioned yesterday, I see those sorts of
> cherry-pick-with-something-on-top conflicts when I am rebasing onto or
> merging my topics into what you have picked up from the same topic on
> the list.
I wanted to give an update on how this has been going. I've been running
with zdiff3 for almost a month. I keep my merge.conflictstyle set to
diff3, and when I see something that I think might benefit from the
"both sides added" zealousness, I do a "git checkout --conflict=zdiff3"
and examine the result.
I have seen it help, and always when rebasing patches that were accepted
upstream. For example, imagine I added a big block of text in one patch
(e.g., an entire test script). Then I added more tests in a follow-on
patch. Or I change some of the lines from expect_failure to
expect_success. You can see this in t1060 of the
jk/check-corrupt-objects-carefully topic (I didn't try, but you could
probably reproduce by just rebasing it on top of the current master).
When I rebase my version of the patches on your master with the new
content, the conflict for the first patch is useless in diff3. I see
that the base had nothing, upstream added a hundred lines, and my patch
added ninety lines. But it's hard to see which lines are missing or
modified because of the size of the conflict. It looks like:
<<<<<<< ours
#!/bin/sh
test_description=whatever
...
end of some test
'
test_done
||||||| base
=======
#!/bin/sh
test_description=whatever
...
end of another test
'
test_done
>>>>>>> theirs
The interesting part is in the "...", which contains different lines in
each version, but it may be hundreds of lines long. Using zdiff3, I get:
#!/bin/sh
test_description=whatever
...
<<<<<<< ours
test_expect_success 'some_new_test' '
...
||||||| base
=======
>>>>>>> theirs
'
test_done
I can see that nothing was tweaked; I just didn't add any content there,
and upstream did. Contrast this with zealous "merge" conflicts, which
would look like:
#!/bin/sh
test_description=whatever
...
<<<<<<< ours
test_expect_success 'some_new_test' '
...
=======
>>>>>>> theirs
'
test_done
which similarly condenses, but is missing a piece of information: that
there was nothing in the base. I don't know whether the conflict is
there because my patch removed some content that got changed upstream,
or whether upstream added some content that I did not have in my patch.
So I think it is useful when rebasing on top of what upstream took,
specifically when:
1. You have a series that updates the same hunk repeatedly (because
from your perspective, you see only the tip of what upstream took).
2. Upstream takes your patch but tweaks it (either as a fixup, to deal
with a merge conflict, or whatever). You get to see the minimal
tweak, not the fact that you have a giant hunk which differs from
the upstream only by a few characters or a few lines.
So I do think zdiff3 is useful, and I plan to continue using it.
-Peff
next prev parent reply other threads:[~2013-04-04 20:34 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 15:05 feature suggestion: optimize common parts for checkout --conflict=diff3 Uwe Kleine-König
2013-03-06 18:27 ` Antoine Pelisse
2013-03-06 19:26 ` Antoine Pelisse
2013-03-06 20:03 ` Jeff King
2013-03-06 20:36 ` [PATCH] xdiff: implement a zealous diff3 Uwe Kleine-König
2013-03-06 20:46 ` Jeff King
2013-03-06 20:40 ` feature suggestion: optimize common parts for checkout --conflict=diff3 Junio C Hamano
2013-03-06 20:54 ` Jeff King
2013-03-06 21:09 ` Junio C Hamano
2013-03-06 21:21 ` Jeff King
2013-03-06 21:50 ` Junio C Hamano
2013-03-07 1:02 ` Jeff King
2013-03-06 21:31 ` Uwe Kleine-König
2013-03-06 21:32 ` Junio C Hamano
2013-03-07 8:04 ` Jeff King
2013-03-07 17:26 ` Junio C Hamano
2013-03-07 18:01 ` Jeff King
2013-03-07 18:40 ` Junio C Hamano
2013-03-07 18:50 ` Jeff King
2013-04-04 20:33 ` Jeff King [this message]
2013-04-04 20:49 ` Uwe Kleine-König
2013-04-04 20:54 ` Jeff King
2013-04-04 21:19 ` Junio C Hamano
2013-03-07 18:21 ` Junio C Hamano
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=20130404203344.GA25330@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=apelisse@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kernel@pengutronix.de \
--cc=u.kleine-koenig@pengutronix.de \
/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).