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

Re: git-rerere observations and feature suggestions

From
Karl Hasselström <kha@treskal.com>
Date
Jun 19, 2008, 10:35 UTC
Message-ID
<20080619103521.GC14415@diana.vm.bytemark.co.uk>
In-Reply-To
<20080619100637.GO29404@genesis.frugalware.org>
On 2008-06-19 12:06:37 +0200, Miklos Vajna wrote:
> You can store them as a blob, make a tree of them and make a commit
> in the log branch point to the tree. This one has the advantage of
> being able to do a 'git log' on a particular patch of the patch set.

If I don't store the pre or post tree in its entirety, I lose the ability to do patch application by three-way merge. (The current StGit design assumes that we can always make a three-way merge as a last resort when applying patches. Basically, StGit is just a fancy way to rebase.)

But yes, this is a viable idea. (Though once I have to store one of the trees, I believe it's actually simpler and cheaper to just store the other tree as well, instead of having to compute the diff and store that in a blob.)

> The other one is to create n+1 trees (and commits, where the first
> commit has no parent) for n patches, and point to the last commit
> from the log branch.

There's actually no point in making more than one commit. A tree can easily hold a lot of sub-trees.

I have an existing implementation that stores the pre and post tree for each patch, plus some metadata (message, author). The issue with this format is that every time we write a new log entry (that is, for every StGit command), we have to call git multiple times in order to write several new trees and blobs.

StGit normally represents each patch by a commit object, so it should be faster to simply write a single new commit to the log that has some metadata in its commit message and just refers to all the patches' commit objects (by having them as parents). Which is why I was inquiring about the maximum number of parents of a commit object.

( Some background: At a given point in time, your StGit stack consists
  of a few applied patches, and a few unapplied patches. The applied
  patches are just a linear sequence of commits at the top of your
  current branch, so we can trivially save them all from the garbage
  collector by making the stack top a parent of our log commit. The
  unapplied patches, however, are commits that are not reachable from
  the stack top -- they can be "pushed" onto the stack by rebasing, at
  which point they become applied, but until then we can't make any
  assumptions about them being ancestors of anything. So a log commit
  potentially has to have _every_ unapplied patch as a parent. (If we
  know that the commit of an unapplied patch used to be applied, we
  know that it's reachable from previous log commits, but we don't
  always know that.) )
-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Previous: Miklos VajnaNext: Junio C Hamano
Message 36 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.