git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: "Michel Dänzer" <michel@daenzer.net>,
	"Git List" <git@vger.kernel.org>,
	"Daniel Stone" <daniel@fooishbar.org>
Subject: Re: Bug report: git rebase ignores different context, resulting in subtle breakage
Date: Wed, 6 Jan 2021 08:17:36 -0800	[thread overview]
Message-ID: <CABPp-BEOXgyq-JtjEkTkPe1sbW5e6hwwAgHc88n09PtAbZBBYQ@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cSe267W7hO8a38ifCw_r4eabUA6WB9MDhS=GttTxELpVg@mail.gmail.com>

On Tue, Jan 5, 2021 at 10:12 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
>
> On Tue, Jan 5, 2021 at 4:34 AM Michel Dänzer <michel@daenzer.net> wrote:
> > On 2020-12-14 3:37 p.m., Michel Dänzer wrote:
> > > (Originally reported as a GitLab issue:
> > > https://gitlab.com/gitlab-org/gitlab/-/issues/292754)
> >
> > Does the lack of response mean this is considered not a bug?
>
> Perhaps the original slipped under the radar of the area experts.
> Adding Elijah to the Cc: list...

I'm not actually an expert with three-way content merging.  That's the
stuff handled by the xdiff library; I work on the stuff above that
layer (covering things such as directory/file conflicts, rename
detection, recursive merge base consolidation, not enough or too many
files for three-way content merging, filetypes that can't be three-way
content merged such as symlinks or submodules or binary files, etc.)

It looks like Phillip already answered here too, but you had more
questions.  Maybe I could try to elaborate on the answer a tiny bit.
I did try out the testcase and noted that while "git apply" fails
(unless you pass the --3way flag), a "git rebase --apply" succeeds due
to usage of the --3way flag which falls back to a three-way merge
instead of doing a patch application.  "git rebase --merge" succeeds
since it jumps straight to the three-way merge.

git-apply/git-am need three context lines to succeed, yes, but xdiff
has a full copy of all three files it is merging.  It does NOT apply
patches.  And if you line up the relevant sections of the three files,
to me it looks like the relevant change made by
gitlab-issue-292754/pre-rebase is a subset of the change made by
gitlab-issue-292754/base.  Yes, there's just one common unchanged line
separating the two hunks in the second commit, which seems to be your
point of contention, but it doesn't seem surprising to me at least.  I
think it's kind of similar to
clean-textual-merge-but-semantic-conflict cases -- for example, one
side adds a new caller of some function, and the other side changes
the signature of that function.  That will merge cleanly, but fail to
even compile.  The "context" is different, but the only way to
correctly merge that is have a human (perhaps with the aid of an
automated testsuite) take a look at the result.  Such is always the
case with merges.

However, that's just my gut take and as I said, I'm by no means an
expert with three-way content merges.  Maybe an xdiff expert could
comment more.

Elijah

  reply	other threads:[~2021-01-06 16:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14 14:37 Bug report: git rebase ignores different context, resulting in subtle breakage Michel Dänzer
2021-01-05  9:32 ` Michel Dänzer
2021-01-05 18:12   ` Eric Sunshine
2021-01-06 16:17     ` Elijah Newren [this message]
2021-01-06 15:40 ` Phillip Wood
2021-01-06 16:04   ` Michel Dänzer

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=CABPp-BEOXgyq-JtjEkTkPe1sbW5e6hwwAgHc88n09PtAbZBBYQ@mail.gmail.com \
    --to=newren@gmail.com \
    --cc=daniel@fooishbar.org \
    --cc=git@vger.kernel.org \
    --cc=michel@daenzer.net \
    --cc=sunshine@sunshineco.com \
    /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).