Git Notes idea.
From: Govind Salinas <hidden>
Date: 2016-06-15 22:45:47
Hi All,
I was thinking about possible ideas for my little pet project and I
had and idea for way to tack on notes to a commit, or any object
really. I know that the idea has been flying around for a long time
but there has never been any implementation or a concept that people
liked enough to use (unless I have missed something).
Here is my idea.
.git/refs/notes contains a tree-id (assuming that using a tree-id
will not cause any problems, otherwise a commit object can be used.
it does not *need* a history, but it *could* have one).
That tree has a structure similar to the layout of .git/objects, where
it is 2 letter subdirectories for the notes objects.
Given a git object (commit, tree, blob, tag), use its sha as the
path/filename in this tree.
If I have a commit 1234567890123456789012345678901234567890 then
the notes tree will have a file
12/34567890123456789012345678901234567890
That file has a list of sha1s (one per line). These shas are object
IDs for blobs that have the notes or whatever that you want attached
to the item.
I think you get the idea. When looking up an item, it should be
fairly easy to have the notes tree and subtrees available for doing
lookups. And as far as I know stuff under .git/refs can be
pushed/pulled even if its not under heads or remotes or tags using
already existing machinery. I am not sure, but I think that would
satisfy gc operations as well. Also, these trees and blobs never have
to be put in the working directory.
Does this sound like something that is workable? I thought it might
appeal since it uses only features that are already present.
This could be extended so that you have different sets of notes under
.git/refs/notes/<my note set> or whatever. So that you can have some
notes you keep private and some that you publish or whatever.
OK, hopefully this isn't a off the wall,
thats-what-you-get-for-being-up-at-2-AM idea.
Thanks,
Govind.