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

Re: git-rerere observations and feature suggestions

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 16, 2008, 19:10 UTC
Message-ID
<7vabhlb3ho.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7vej6xb4lr.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> Ingo Molnar <mingo@elte.hu> writes:
> ...
>>  - Automation: would be nice to have a git-rerere modus operandi where
>>    it would auto-commit things if and only if all conflicting files were 
>>    resolved.
>
> I am not sure how safe this is.  rerere as originally designed does not
> even update the index with merge results so that the application of
> earlier resolution can be manually inspected, and this is exactly because
> I consider a blind textual reapplication of previous resolution always
> iffy, even though I invented the whole mechanism.

By the way, this safety is not a theoretical issue but has been a real one. I had two topics that changed the calling convention of the same function in different ways, and when they were merged to 'pu', the declaration, definition, and call sites existed on both of these branches were handled beautifully by rerere.

Recording autoresolution would have been a wrong thing to do. One of the branches added a new call site to a file that was not among the ones that conflicted in the merge between the two branches. That call site, that uses the calling convention of one branch, needed to be adjusted to accomodate the change of calling convention from the other branch (from textual merge's point of view, this has to be an evil merge). I had to make and keep a mental note about that new call site until both topics graduated to 'master' (similar to your need to remember a particular merge is resolved to removal right now).

To safely automate reapplication of such a merge, rerere needs to become much more clever.

The conflicts rerere notices and records are strictly per blob. A conflicted merge to a blob is inspected and a "conflict signature", which becomes the directory name under rr-cache, is computed. We record the conflicted blob as a whole as the preimage, and your hand resolution as a whoe as the postimage. Next time when you have a conflicted merge to a blob, and the conflict has the exact same conflict signature, we run three-way merge between the recorded preimage, postimage and the new conflicted result.

If we want to handle new call sites added only on a single side, you should be able to express something like "when a merge has a conflicted blob with this conflict signature, look in the whole tree, even outside the set of conflicted paths, and change this text to that". This is too much automation and I somehow think the potential for errors (both from the tool and from the user) is too high.

Previous: Karl HasselströmNext: Ingo Molnar
Message 37 of 45 in “git-rerere observations and feature suggestions”
  1. Ingo MolnarJun 16, 2008
  2. Mike HommeyJun 16, 2008
  3. Pierre HabouzitJun 16, 2008
  4. Pierre HabouzitJun 16, 2008
  5. Sverre RabbelierJun 16, 2008
  6. Karl HasselströmJun 17, 2008
  7. David KastrupJun 16, 2008
  8. Theodore TsoJun 16, 2008
  9. David KastrupJun 16, 2008
  10. Ingo MolnarJun 16, 2008
  11. Junio C HamanoJun 16, 2008
  12. Ingo MolnarJun 16, 2008
  13. Junio C HamanoJun 16, 2008
  14. Junio C HamanoJun 16, 2008
  15. Ingo MolnarJun 16, 2008
  16. Junio C HamanoJun 16, 2008
  17. 1/5 rerere: rerere_created_at() and has_resolution() abstractionJunio C Hamano, Jun 22, 2008
  18. 2/5 git-rerere: detect unparsable conflictsJunio C Hamano, Jun 22, 2008
  19. 3/5 rerere: remove dubious "tail_optimization"Junio C Hamano, Jun 22, 2008
  20. 4/5 t4200: fix rerere testJunio C Hamano, Jun 22, 2008
  21. 5/5 rerere.autoupdateJunio C Hamano, Jun 22, 2008
  22. Ingo MolnarJun 18, 2008
  23. Miklos VajnaJun 18, 2008
  24. Ingo MolnarJun 18, 2008
  25. Miklos VajnaJun 18, 2008
  26. Ingo MolnarJun 18, 2008
  27. Jakub NarebskiJun 18, 2008
  28. Miklos VajnaJun 18, 2008
  29. Karl HasselströmJun 19, 2008
  30. Miklos VajnaJun 19, 2008
  31. Junio C HamanoJun 19, 2008
  32. Karl HasselströmJun 19, 2008
  33. Miklos VajnaJun 19, 2008
  34. Karl HasselströmJun 19, 2008
  35. Miklos VajnaJun 19, 2008
  36. Karl HasselströmJun 19, 2008
  37. Junio C HamanoJun 16, 2008
  38. Ingo MolnarJun 16, 2008
  39. Ingo MolnarJun 23, 2008
  40. Peter ZijlstraJun 23, 2008
  41. Peter ZijlstraJun 23, 2008
  42. Jeff KingJun 23, 2008
  43. Ingo MolnarJun 23, 2008
  44. Jakub NarebskiJun 16, 2008
  45. Johannes SchindelinJun 17, 2008

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.