git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Richard Peterson <richard@rcpeterson.com>
Cc: git@vger.kernel.org
Subject: Re: [Tagging Commits] feedback / discussion request
Date: Thu, 5 May 2011 16:30:16 -0400	[thread overview]
Message-ID: <20110505203016.GD1770@sigill.intra.peff.net> (raw)
In-Reply-To: <BANLkTinCxzXCmmtxXSM7=+yeve2hhLSYNQ@mail.gmail.com>

On Thu, May 05, 2011 at 11:39:41AM -0400, Richard Peterson wrote:

> >  3. In git notes. You can do something like:
> >
> >       (git rev-parse --verify HEAD
> >        echo "I reviewed this"
> >       ) | gpg --sign -a |
> >       git notes add -F - HEAD
> >
> >     though you'd probably want to be a little more complex, and handle
> >     lists of signed notes for each commit. And you may want to store
> >     these in a separate notes ref from the default one.
> 
> I had looked at this option, but had failed to see the usefulness of using
> a different ref. I was worried about cluttering things up, overloading the
> intended purpose of notes, and so forth. I wasn't really sure if notes were
> intended to be general purpose storage for systematic, structured data.

They are definitely intended to be general purpose storage. For one such
(ab)use, see the textconv-caching subsystem. It maps binary blobs into
their converted text counterparts. So we are keying on blobs (not
commits!), and storing arbitrarily gigantic data in the notes values.
And the nice thing is that because notes use git objects for storage, we
get all the usual delta compression benefits on the result.

> My inclination was to do this outside notes, or even in a parallel
> implementation to notes, factoring out the common parts. I suppose that
> looking at notes as somewhat of a free-for-all obviates this need. Is this
> really what notes are for?

Yep. Definitely use notes if you are going to do the storage in git.

> >     The advantage of notes are that they are designed for lots of
> >     per-commit storage, and can be accessed fairly efficiently.
> 
> That was my other concern about notes - performance. Not sure how
> notes are stored, but I certainly trust you that they're efficient.

Each notes tree is stored as a git tree full of entries representing the
commit (or other object) hashes. And each entry points to a blob which
is the note's value. And then as the notes change over time, we version
them with commit objects. So you can make notes and your coworker can
make notes, and you can merge them together.

For fun, you can do:

  # make a repo to play around in
  git clone /path/to/some/repo notes-test
  cd notes-test

  # make some notes. You could also use "notes add -F"
  # to add notes with arbitrary binary content.
  git notes --ref=foo add -m "this is note 1" HEAD
  git notes --ref=foo add -m "this is note 2" HEAD^

  # check them out in context
  git log --show-notes=foo -2

  # and then see how they're stored
  git checkout refs/notes/foo
  grep . *

> > Developers would have to make a note and push their notes tree first,
> 
> You mean for hook / verification purposes? Or is there some underlying
> reason to push notes first?

Yeah, for a pre-receive hook. You need to first tell the server "here
are some signatures" by pushing the notes, and then it can verify those
signatures when trying to put commits on actual branches.

> I'll be sure to share.

Great. I look forward to seeing the result.

-Peff

      parent reply	other threads:[~2011-05-05 20:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 23:36 [Tagging Commits] feedback / discussion request Richard Peterson
2011-05-03 23:49 ` Sverre Rabbelier
2011-05-04  9:21   ` Michael J Gruber
2011-05-04  8:42 ` Jeff King
2011-05-05 15:39   ` Richard Peterson
2011-05-05 18:49     ` Sverre Rabbelier
2011-05-05 20:30     ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110505203016.GD1770@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=richard@rcpeterson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).