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

Re: Multi-ancestor read-tree notes

From
Junio C Hamano <junkio@cox.net>
Date
Sep 9, 2005, 17:29 UTC
Message-ID
<7vy866i1zc.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.63.0509050049030.23242@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> writes:
Show 13 quoted lines
> In case #16, I'm not sure what I should produce. I think the best thing 
> might be to not leave anything in stage 1. The desired end effect is that 
> the user is given a file with a section like:
>
>   {
>     *t = NULL;
>     *m = 0;
> <<<<<<<<
>     return Z_DATA_ERROR;
> ========
>     return Z_OK;
>>>>>>>>>
>   }

I was thinking a bit more about this. Let's rephrase case #16. I'll call merge bases O1, O2,... and merge heads A and B, and we are interested in one path.

If O1 and O2, the path has quite different contents. A has the same contents as O1 and B has the same contents as O2. We should not just pick one or the other and do two-file merge between the version in A and B (we could prototype by massaging 'diff A B' output to produce what is common between A and B and run (RCS) merge of A and B pretending that the common contents is the original to produce something like the above).

If A has slight changes since O1 but B did not change since O2, ideally I think we would want the same thing to happen. Let's call it case #16+.

What does the current implementation do? It is not case #16 because A and O1 does not exactly match. I suspect the result will be skewed because B has an exact match with O2. The situation becomes more interesting if both A and B has slight changes since O1 and O2 respectively. They do not exactly match with their bases, but I think ideally we would like something very similar to case #16 resolution to happen.

One way to solve this would be to try doing things entirely in read-tree by doing not just exact matches but also checking the amount of changes -- if each heads has similar but different base call it case #16 and try two-file merge between the heads disregarding the bases.

But I am a bit reluctant to suggest this. My gut feeling tells me that these 'interesting' cases are easier if scripted outside read-tree machinery to later enhance and improve the heuristics.

Of course, the current case #16 detected by the exact match rule should be something we can automatically handle, but to make things safer to use I think we should have a way to detect case #16+ situlation and avoid mistakenly favoring A over B (or vice versa) only because one has slight modification while the other does not.

Previous: Daniel BarkalowNext: Daniel Barkalow
Message 16 of 18 in “Multi-ancestor read-tree notes”
  1. Daniel BarkalowSep 5, 2005
  2. Junio C HamanoSep 6, 2005
  3. Daniel BarkalowSep 6, 2005
  4. Junio C HamanoSep 6, 2005
  5. Daniel BarkalowSep 6, 2005
  6. Junio C HamanoSep 6, 2005
  7. Daniel BarkalowSep 6, 2005
  8. Junio C HamanoSep 10, 2005
  9. Junio C HamanoSep 10, 2005
  10. Darrin ThompsonSep 8, 2005
  11. Fredrik KuivinenSep 8, 2005
  12. Daniel BarkalowSep 8, 2005
  13. Darrin ThompsonSep 8, 2005
  14. Junio C HamanoSep 8, 2005
  15. Daniel BarkalowSep 8, 2005
  16. Junio C HamanoSep 9, 2005
  17. Daniel BarkalowSep 9, 2005
  18. Matthias UrlichsSep 11, 2005

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.