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

Re: [PATCH 0/2] RFC: implement new zdiff3 conflict style

From
Jeff King <peff@peff.net>
Date
Jun 23, 2021, 22:28 UTC
Message-ID
<YNO1p93gHN4RPZaV@coredump.intra.peff.net>
In-Reply-To
<f76c79d6-f280-3011-d88d-6de146977626@gmail.com>
On Wed, Jun 23, 2021 at 10:53:25AM +0100, Phillip Wood wrote:
Show 16 quoted lines
> > Thanks for figuring that out. I agree that the output after the patch
> > you showed is correct, in the sense that the common lines show up in the
> > base now. It does feel like it's working against the point of zdiff3,
> > though, which is to reduce the number of common lines shown in the
> > "ours" and "theirs" hunks.
> 
> I agree - the output is longer rather than shorter. As we only want to trim
> the common prefix and suffix from the conflicts I wonder if it would be
> better to special case zdiff3 rather than piggy backing on the existing
> XDL_MERGE_ZEALOUS implementation. We can trim the common lines by looping
> over the begging and end of the hunk comparing the lines with xdl_recmatch()
> without going to the trouble of diffing them as XDL_MERGE_ZEALOUS does. I
> don't think we need to worry about coalescing adjacent conflicts for zdiff3.
> It makes sense to coalesce in the XDL_MERGE_ZEALOUS case as it can
> potentially split a  N line conflict hunk into N/2 single line conflict
> hunks but zdiff3 does not split conflict hunks.

That matches my intuition of a reasonable path forward (but I confess to not being too well-versed in the details of the XDL_MERGE internals).

Show 7 quoted lines
> Yes, I think the heuristic for coalescing conflict hunks could be improved.
> It would be fairly simple to only join two hunks if the conflicts are longer
> that the context between them and the existing XDL_MERGE_ZEALOUS_ALNUM logic
> allows conflicts with more context between them to be coalesced if the
> context lines are uninteresting. I think XDL_MERGE_ZEALOUS_ALNUM is only
> used by `git merge-file` at the moment, with everything else going through
> ll_merge() which uses XDL_MERGE_ZEALOUS

I don't recall much discussion around using ALNUM versus not, nor could I find much in the archive. It looks like merge-file was converted to show off ALNUM when it was added in ee95ec5d58 (xdl_merge(): introduce XDL_MERGE_ZEALOUS_ALNUM, 2008-02-17), and it never really progressed from there.

It might be an interesting exercise to re-run a bunch of merges and see if ALNUM produces better (or worse) results on the whole.

-Peff
Previous: Phillip WoodNext: Elijah Newren
Message 14 of 39 in “RFC: implement new zdiff3 conflict style”
  1. 0/2 RFC: implement new zdiff3 conflict styleElijah Newren via GitGitGadget, Jun 15, 2021
  2. 1/2 xdiff: implement a zealous diff3, or "zdiff3"Elijah Newren via GitGitGadget, Jun 15, 2021
  3. Junio C HamanoJun 15, 2021
  4. Felipe ContrerasJun 15, 2021
  5. Elijah NewrenJun 15, 2021
  6. Sergey OrganovJun 15, 2021
  7. 2/2 update documentation for new zdiff3 conflictStyleElijah Newren via GitGitGadget, Jun 15, 2021
  8. Junio C HamanoJun 15, 2021
  9. Jeff KingJun 15, 2021
  10. Elijah NewrenJun 15, 2021
  11. Phillip WoodJun 16, 2021
  12. Jeff KingJun 16, 2021
  13. Phillip WoodJun 23, 2021
  14. Jeff KingJun 23, 2021
  15. Elijah NewrenJun 17, 2021
  16. Johannes SixtJun 15, 2021
  17. Elijah NewrenJun 15, 2021
  18. Johannes SixtJun 16, 2021
  19. Elijah NewrenJun 16, 2021
  20. 0/2 RFC: implement new zdiff3 conflict styleElijah Newren via GitGitGadget, Sep 11, 2021
  21. 1/2 xdiff: implement a zealous diff3, or "zdiff3"Elijah Newren via GitGitGadget, Sep 11, 2021
  22. Phillip WoodSep 15, 2021
  23. Phillip WoodSep 15, 2021
  24. Elijah NewrenSep 18, 2021
  25. Phillip WoodSep 24, 2021
  26. Elijah NewrenSep 18, 2021
  27. Phillip WoodSep 24, 2021
  28. 2/2 update documentation for new zdiff3 conflictStyleElijah Newren via GitGitGadget, Sep 11, 2021
  29. 0/2 RFC: implement new zdiff3 conflict styleElijah Newren via GitGitGadget, Sep 18, 2021
  30. 1/2 xdiff: implement a zealous diff3, or "zdiff3"Elijah Newren via GitGitGadget, Sep 18, 2021
  31. 2/2 update documentation for new zdiff3 conflictStyleElijah Newren via GitGitGadget, Sep 18, 2021
  32. 0/2 Implement new zdiff3 conflict styleElijah Newren via GitGitGadget, Nov 16, 2021
  33. 1/2 xdiff: implement a zealous diff3, or "zdiff3"Phillip Wood via GitGitGadget, Nov 16, 2021
  34. 2/2 update documentation for new zdiff3 conflictStyleElijah Newren via GitGitGadget, Nov 16, 2021
  35. 0/2 Implement new zdiff3 conflict styleElijah Newren via GitGitGadget, Dec 1, 2021
  36. 1/2 xdiff: implement a zealous diff3, or "zdiff3"Phillip Wood via GitGitGadget, Dec 1, 2021
  37. 2/2 update documentation for new zdiff3 conflictStyleElijah Newren via GitGitGadget, Dec 1, 2021
  38. Bagas SanjayaDec 2, 2021
  39. Eric SunshineDec 2, 2021

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.