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

Re: Git Notes idea.

From
Jeff King <peff@peff.net>
Date
Dec 17, 2008, 10:11 UTC
Message-ID
<20081217101110.GC18265@coredump.intra.peff.net>
In-Reply-To
<alpine.DEB.1.00.0812170420560.14632@racer>
On Wed, Dec 17, 2008 at 04:43:57AM +0100, Johannes Schindelin wrote:
Show 8 quoted lines
> > I agree, I haven't thought of any fix along these lines other than to 
> > make gc do the clean up.
> 
> I have, and IIRC I briefly mentioned it back then.  Basically, you will 
> have to add a "git notes gc" or some such, which basically reads in the 
> whole notes, traverses all reachable commits, marking the corresponding 
> notes, and then writes out all marked notes (leaving the other notes 
> behind).

I was thinking something similar, but I think it is even easier. Make the rule "if we still have the object, then we still have the note". That has three benefits:

 - implementation is simple: for each note $n, delete it unless
   has_sha1_file($n).
 - it handles notes on non-commit objects
 - it kills off notes when an object is _pruned_, not when it stops
   being _reachable_. So if I delete a branch with a commit found
   nowhere else, its notes will hang around until it is actually pruned.
   If I pull it from lost+found, I still keep the notes.

Note that all of this garbage collection of notes is really just removing them from the most current notes _tree_. If the notes structure is actually composed of commits, then old notes that are "deleted" will still be available historically.

> I wonder why you speak as if none of that had been implemented yet.  From 
> my work, it is obvious that hashtable is better than sorted list (except 
> for the fan-out, which obviously wants to be an array), and from Peff's it 
> is obvious that we want to keep the hashtables in memory.

If he is planning on doing a separate pyrite implementation, then it _hasn't_ been implemented yet. And I don't care there if he uses hash tables or sorted lists or whatever. I think the most important thing is getting down the design of the _data structure_, so that we can have a compatible implementation inside git itself.

Show 5 quoted lines
> > IMO notes are just a generallized tag.
> 
> IMO notes have nothing to do with a tag.  Tags point to commits (or other 
> objects, but that's beside the point here).  Notes are pointed _to_ by 
> commits.

I think maybe we are just talking about semantics, but I think notes are not pointed to by commits. There is an external mapping of commits to notes, which is very different. I can give you the commit without you knowing the notes, or that the notes even exist.

But in practice, I don't know if this distinction is going to influence any of the design or use.

> Has the tree changed?  Sure it has.  Because Junio committed and pushed 
> some changes.

I think it is safe to say the tree generally changes for rebase, but not necessarily for something like an amended commit, or a pull of a patch sent by mail. So there are times when it changes, and times when it doesn't.

And if there were some simple way of handling the times when it didn't change at no general cost, I think going that way would be fine. But:

> And the worst part about your idea to attach notes to trees rather than 
> commits:  For things like Acked-by:... you very much want to annotate the 
> commit, _not_ the tree.  The tree is useless here.  It says nothing about 
> the patch, nothing about the explanation, and nothing about the history.

This is a huge cost, IMHO. I think you generally want to annotate commits, not trees, and the semantic difference is important (but again, I think all of the proposals are capable of doing either -- but if you want a "show me the notes on this commit" feature to interoperate, it needs to pick one).

Show 6 quoted lines
> > root/
> >      12/
> >          34567890123456789012345678901234567890/
> >              <type>
> 
> Funny.  That is Peff's proposal.
Clearly we have independent verification that it's a good idea. ;)
-Peff
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 32 of 41 in “Git Notes idea.”
  1. Govind SalinasDec 16, 2008
  2. Jeff KingDec 16, 2008
  3. Jeff KingDec 16, 2008
  4. Govind SalinasDec 16, 2008
  5. Johannes SchindelinDec 16, 2008
  6. Jeff KingDec 17, 2008
  7. Petr BaudisDec 17, 2008
  8. Jeff KingDec 17, 2008
  9. Govind SalinasDec 17, 2008
  10. Jeff KingDec 18, 2008
  11. rebasing commits that have notes, was Re: Git Notes idea.Johannes Schindelin, Dec 17, 2008
  12. Johan HerlandDec 17, 2008
  13. Stephan BeyerDec 17, 2008
  14. 0/4 Notes reloadedJohannes Schindelin, Dec 19, 2008
  15. 1/4 Introduce commit notesJohannes Schindelin, Dec 19, 2008
  16. Jeff KingDec 20, 2008
  17. Robin RosenbergDec 20, 2008
  18. Jeff KingDec 20, 2008
  19. Junio C HamanoDec 20, 2008
  20. Jeff KingDec 20, 2008
  21. Junio C HamanoDec 20, 2008
  22. 0/4 Notes, reloadedJohannes Schindelin, Dec 20, 2008
  23. 1/4 Introduce commit notesJohannes Schindelin, Dec 20, 2008
  24. 2/4 Add a script to edit/inspect notesJohannes Schindelin, Dec 20, 2008
  25. 3/4 Speed up git notes lookupJohannes Schindelin, Dec 20, 2008
  26. 4/4 Add an expensive test for git-notesJohannes Schindelin, Dec 20, 2008
  27. 2/4 Add a script to edit/inspect notesJohannes Schindelin, Dec 19, 2008
  28. 3/4 Speed up git notes lookupJohannes Schindelin, Dec 19, 2008
  29. 4/4 Add an expensive test for git-notesJohannes Schindelin, Dec 19, 2008
  30. Boyd Stephen Smith Jr.Dec 19, 2008
  31. Johannes SchindelinDec 20, 2008
  32. Jeff KingDec 17, 2008
  33. Johannes SchindelinDec 17, 2008
  34. Junio C HamanoDec 17, 2008
  35. Johannes SchindelinDec 18, 2008
  36. Govind SalinasDec 19, 2008
  37. Govind SalinasDec 19, 2008
  38. Govind SalinasDec 19, 2008
  39. Jeff KingDec 19, 2008
  40. Govind SalinasDec 19, 2008
  41. Jeff KingDec 20, 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.