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

Re: Feature request: a merge strategy that makes any file difference a merge conflict

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 29, 2024, 19:40 UTC
Message-ID
<xmqqfrw8ygg2.fsf@gitster.g>
In-Reply-To
<CAAJCdQQB3_DWOTCTbb-TAkLUX_XVd5TBd3z0M2_KrHxKxr69Kw@mail.gmail.com>
Michael Ernst <mernst@cs.washington.edu> writes:
Show 5 quoted lines
> Git's built-in merge strategies, such as ort, sometimes create a
> clean-but-incorrect merge.  A merge driver or a mergetool cannot be
> used to correct such problems, because a merge driver or mergetool is
> only called when the strategy resulted in a conflict (so far as I
> understand).

A custom low-level merge driver is always called when selected via the attribute mechansism (see how merge-ll.c:ll_merge() calls find_ll_merge_driver()) and participates in a content-level 3-way merge.

If you are trying to interfere with cases that a content-level 3-way merge does not kick in (e.g., your side did not change anything in the file since their history forked, and they modified the file; the tree level 3-way merge will resolve it to take their version), then it is true that the low-level merge driver is not invoked, but I somehow get an impression from the above description that it is not what you are trying to do.

> It is challenging to write a merge strategy, but it is
> much easier to write a merge driver or a mergetool.

A merge strategy is about performing three-way merge at the tree level, figuring out which three variants of contents to hand to a merge driver that handles the content-level three-way merge. They serve totally different purposes and comparing them is like comparing apples and oranges.

Previous: Michael ErnstNext: Michael Ernst
Message 2 of 4 in “Feature request: a merge strategy that makes any file difference a merge conflict”
  1. Michael ErnstMar 29, 2024
  2. Junio C HamanoMar 29, 2024
  3. Michael ErnstMar 29, 2024
  4. Thomas BraunApr 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.