git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 0/2] RFC: implement new zdiff3 conflict style
Date: Tue, 15 Jun 2021 12:35:28 -0700	[thread overview]
Message-ID: <CABPp-BE7-E03+x38EK-=AE5mwwdST+d50hiiud2eY2Nsf3rM5g@mail.gmail.com> (raw)
In-Reply-To: <YMh2M8Ek/RUVjKkL@coredump.intra.peff.net>

On Tue, Jun 15, 2021 at 2:43 AM Jeff King <peff@peff.net> wrote:
>
> On Tue, Jun 15, 2021 at 05:16:08AM +0000, Elijah Newren via GitGitGadget wrote:
>
> > Implement a zealous diff3, or "zdiff3". This new mode is identical to
> > ordinary diff3 except that it allows compaction of common lines between the
> > two sides of history, if those common lines occur at the beginning or end of
> > a conflict hunk.
> >
> > This is just RFC, because I need to add tests. Also, while I've remerged
> > every merge, revert, or duly marked cherry-pick from both git.git and
> > linux.git with this patch using the new zdiff3 mode, that only shows it
> > doesn't segfault. (Though I also reran 10% of the linux remerges with zdiff3
> > under valgrind without issues.) I looked through some differences between
> > --remerge-diff with diff3 and --remerge-diff with zdiff3, but those are
> > essentially diffs of a diff of a diff, which I found hard to read. I'd like
> > to look through more examples, and use it for a while before submitting the
> > patches without the RFC tag.
>
> I did something similar (but I wasn't smart enough to try your
> remerge-diff, and just re-ran a bunch of merges).

What I did was great for testing if there were funny merges that might
cause segfaults or such with zdiff3, but not so clever for viewing the
direct output from zdiff3.  Using remerge-diff in this way does not
show the [z]diff3 output directly, but a diff of that output against
what was ultimately recorded in the merge, forcing me to attempt to
recreate the original in my head.

(And, of course, I made it even worse by taking the remerge-diff
output with diff3, and the remerge-diff output with zdiff3, and then
diffing those, resulting in yet another layer of diffs that I'd have
to undo in my head to attempt to construct the original.)

> Skimming over the results, I didn't see anything that looked incorrect.
> Many of them are pretty non-exciting, though. A common case seems to be
> ones like 01a2a03c56 (Merge branch 'jc/diff-filter-negation',
> 2013-09-09), where two sides both add functions in the same place, and
> the common lines are just the closing "}" followed by a blank line.
>
> Removing those shared lines actually makes things less readable, IMHO,
> but I don't think it's the wrong thing to do. The usual "merge" zealous
> minimization likewise produces the same unreadability. If we want to
> address that, I think the best way would be by teaching the minimization
> some heuristics about which lines are trivial.
>
> Here's another interesting one. In 0c52457b7c (Merge branch
> 'nd/daemon-informative-errors-typofix', 2014-01-10), the diff3 looks
> like:
>
>   <<<<<<< ours
>                   if (starts_with(arg, "--informative-errors")) {
>   ||||||| base
>                   if (!prefixcmp(arg, "--informative-errors")) {
>   =======
>                   if (!strcmp(arg, "--informative-errors")) {
>   >>>>>>> theirs
>                           informative_errors = 1;
>                           continue;
>                   }
>   <<<<<<< ours
>                   if (starts_with(arg, "--no-informative-errors")) {
>   ||||||| base
>                   if (!prefixcmp(arg, "--no-informative-errors")) {
>   =======
>                   if (!strcmp(arg, "--no-informative-errors")) {
>   >>>>>>> theirs
>
> A little clunky, but it's easy-ish to see what's going on. With zdiff3,
> the context between the two hunks is rolled into a single hunk:
>
>   <<<<<<< ours
>                   if (starts_with(arg, "--informative-errors")) {
>                           informative_errors = 1;
>                           continue;
>                   }
>                   if (starts_with(arg, "--no-informative-errors")) {
>   ||||||| base
>                   if (!prefixcmp(arg, "--informative-errors")) {
>   =======
>                   if (!strcmp(arg, "--informative-errors")) {
>                           informative_errors = 1;
>                           continue;
>                   }
>                   if (!strcmp(arg, "--no-informative-errors")) {
>   >>>>>>> theirs
>
> which seems worse. I haven't dug/thought carefully enough into your
> change yet to know if this is expected, or if there's a bug.

Yeah, I don't know for sure either but that does look buggy to me.
Thanks for digging up these examples.  I'm a bit overdrawn on time for
this, so I'll pick it back up in a week or two and investigate this
case further.

  reply	other threads:[~2021-06-15 19:35 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15  5:16 [PATCH 0/2] RFC: implement new zdiff3 conflict style Elijah Newren via GitGitGadget
2021-06-15  5:16 ` [PATCH 1/2] xdiff: implement a zealous diff3, or "zdiff3" Elijah Newren via GitGitGadget
2021-06-15  6:13   ` Junio C Hamano
2021-06-15  9:40   ` Felipe Contreras
2021-06-15 18:12     ` Elijah Newren
2021-06-15 18:50       ` Sergey Organov
2021-06-15  5:16 ` [PATCH 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-06-15  6:21   ` Junio C Hamano
2021-06-15  9:43 ` [PATCH 0/2] RFC: implement new zdiff3 conflict style Jeff King
2021-06-15 19:35   ` Elijah Newren [this message]
2021-06-16  8:57     ` Phillip Wood
2021-06-16 10:31       ` Jeff King
2021-06-23  9:53         ` Phillip Wood
2021-06-23 22:28           ` Jeff King
2021-06-17  5:03       ` Elijah Newren
2021-06-15 21:36 ` Johannes Sixt
2021-06-15 21:45   ` Elijah Newren
2021-06-16  6:16     ` Johannes Sixt
2021-06-16  8:14       ` Elijah Newren
2021-09-11 17:03 ` [PATCH v2 " Elijah Newren via GitGitGadget
2021-09-11 17:03   ` [PATCH v2 1/2] xdiff: implement a zealous diff3, or "zdiff3" Elijah Newren via GitGitGadget
2021-09-15 10:25     ` Phillip Wood
2021-09-15 11:21       ` Phillip Wood
2021-09-18 22:06         ` Elijah Newren
2021-09-24 10:09           ` Phillip Wood
2021-09-18 22:04       ` Elijah Newren
2021-09-24 10:16         ` Phillip Wood
2021-09-11 17:03   ` [PATCH v2 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-09-18 23:02   ` [PATCH v3 0/2] RFC: implement new zdiff3 conflict style Elijah Newren via GitGitGadget
2021-09-18 23:02     ` [PATCH v3 1/2] xdiff: implement a zealous diff3, or "zdiff3" Elijah Newren via GitGitGadget
2021-09-18 23:02     ` [PATCH v3 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-11-16  2:13     ` [PATCH v4 0/2] Implement new zdiff3 conflict style Elijah Newren via GitGitGadget
2021-11-16  2:13       ` [PATCH v4 1/2] xdiff: implement a zealous diff3, or "zdiff3" Phillip Wood via GitGitGadget
2021-11-16  2:13       ` [PATCH v4 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-12-01  0:05       ` [PATCH v5 0/2] Implement new zdiff3 conflict style Elijah Newren via GitGitGadget
2021-12-01  0:05         ` [PATCH v5 1/2] xdiff: implement a zealous diff3, or "zdiff3" Phillip Wood via GitGitGadget
2021-12-01  0:05         ` [PATCH v5 2/2] update documentation for new zdiff3 conflictStyle Elijah Newren via GitGitGadget
2021-12-02  8:42           ` Bagas Sanjaya
2021-12-02 13:28             ` Eric Sunshine

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABPp-BE7-E03+x38EK-=AE5mwwdST+d50hiiud2eY2Nsf3rM5g@mail.gmail.com' \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=peff@peff.net \
    /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.
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).