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

Re: Git Notes idea.

From
GSGovind Salinas <govind@sophiasuchtig.com>
Date
Dec 19, 2008, 17:38 UTC
Message-ID
<5d46db230812190938r4e8ff994gfcb616c750be0f22@mail.gmail.com>
In-Reply-To
<5d46db230812190918qf22b874n8d8aeea557083df8@mail.gmail.com>
Sorry, hit the send key accidentally.
On Wed, Dec 17, 2008 at 4:11 AM, Jeff King <peff@peff.net> wrote:
Show 30 quoted lines
> On Wed, Dec 17, 2008 at 04:43:57AM +0100, Johannes Schindelin wrote:
>
> > 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.
>

This is my concern with keeping a history of the notes pseudo-branch. Let me restate what you are saying with an example

1) on branch A commit a
2) add note a`
3) on branch B commit b
4) add note b`
5) on branch B commit c
6) add note c`
7) delete branch A
8) gc after a time such that a is pruned

Now either I will always have a note a` as an object forever even though the only commit that points to it is gone or I have to re-write the history of the notes branch from the point that it was added.

Given this problem, is it really such a good idea to keep the history?

Of course the other side of this conversation is that the merge operation will be more complex since the following can also happen

9) push notes
10) user 2 pulls notes but still has commit a and note a`

On the other, other hand, pushing and pulling notes if a history is kept will have to involve a lot of rebasing/merging.

Just to throw an idea out...
A possible solution is that notes are per-branch,

refs/notes/heads/master refs/notes/heads/foo/bar refs/notes/remotes/baz/bang

and then it is easier to deal with. A published branch's notes are isolated from the changes in unpublished branches. And since published branches aren't *supposed* to change, then the notes should also always be fast forwards. Similarly, if a branch is not considered stable, like pu or even next, then the associated notes branch could be forced in the same way.

Rebase, cherry-pick and merge (and possibly branch/checkout) would have to be updated to handle notes, which is the down side. It also doesn't solve the issue of a history causing us to keep notes after the aren't useful anymore.

So perhaps we could use the above layout with no history?

Thanks, Govind.

Previous: Govind SalinasNext: Jeff King
Message 38 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.