git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Determining if a merge was produced automatically

From
PRPavel Rappo <pavel.rappo@gmail.com>
Date
Jul 1, 2024, 22:26 UTC
Message-ID
<CAChcVukZbVVE0jHGJt44w8D5Pi60+wYXn6Wz3gs+kGd3xmaw8A@mail.gmail.com>
In-Reply-To
<xmqqbk3hx9ik.fsf@gitster.g>
On Mon, Jul 1, 2024 at 7:16 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
>
> Pavel Rappo <pavel.rappo@gmail.com> writes:
>
> > it for such merge commits produced automatically because of the
> > assumption that nothing bad can happen there.
>
> I do not think that assumption holds in the first place, though.  A
> typical and often cited example is when one side changed a helper
> function's behaviour while the other side added new callers to the
> helper function, still assuming the original behaviour.  In such a
> case there may not even be an textual conflict but the end results
> may be broken, and if the breakage is subtle, it may take weeks or
> months before somebody notices such a semantic mismerge.

Junio, I'm under no illusion that Git can resolve semantic conflicts, such as the one you described. When I said "nothing bad can happen" I didn't mean broken code, I meant unreviewed, possibly malicious changes making their way into the target branch.

Suppose, we have the master branch and a PR against that branch. If a new commit is pushed into the PR branch, we want it to be reviewed, unless that commit is a merge from master to the PR branch. In that case, we try to replicate the merge to see if it yields the same result. If the result is the same, we will not require re-review.

Why do we not require a re-review in that case? Because when a PR is integrated, it is merged with the master anyway. That merge is unsupervised and unreviewed. If we flip sides, it means that we may want to not require a review for merging from master to the PR. It's this sense that "nothing bad can happen".

Show 7 quoted lines
> But there, you'd need more than "both are cleanly auto-merged"; more
> like "both may have conflicted but they are resolved the same way"
> is what you are interested, no?  Since at that point, your primary
> interest shouldn't be "does it cleanly auto-merge?" but "do these
> two merges do the same thing?", determining if a merge was created
> automatically becomes a problem you do not need to solve, or solving
> it would not further your true goal.

Automatic merge is just a merge made by git merge or another command that I expect authors to use for occasional merge from master into their PRs. It's not a special merge. It's just a reference merge.

Sorry, I'm not good at writing text. I really hope this email clarifies my use case and what I am trying to do about it.

Show 7 quoted lines
> If you have two integration branches A and B, and a topic branch T
> first gets merged to A and then after proving its worth it gets
> merged down to B, I wonder if you can verify somebody's merge of B
> into T by comparing the result with your "verification merge", which
> you preform locally and on a throw-away branch by using "git rebase
> --rebase-merges" or some mechanism, to replay the original merge of
> T into A on top of B (before the merge of T you are verifying).
That sounds like my first idea with extra steps; not sure.
-Pavel
Previous: Junio C HamanoNext: Martin von Zweigbergk
Message 8 of 11 in “Determining if a merge was produced automatically”
  1. Pavel RappoJun 30, 2024
  2. Jonathan NiederJul 1, 2024
  3. Pavel RappoJul 1, 2024
  4. Junio C HamanoJul 1, 2024
  5. Junio C HamanoJul 1, 2024
  6. Pavel RappoJul 1, 2024
  7. Junio C HamanoJul 1, 2024
  8. Pavel RappoJul 1, 2024
  9. Martin von ZweigbergkJul 1, 2024
  10. Elijah NewrenJul 1, 2024
  11. Pavel RappoJul 1, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.