public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland•net>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org, spearce@spearce•org
Subject: Re: [RFC/PATCHv10 08/11] Notes API: get_note(): Return the note annotating the given object
Date: Tue, 08 Dec 2009 04:18:06 +0100	[thread overview]
Message-ID: <200912080418.06233.johan@herland.net> (raw)
In-Reply-To: <7vk4wy1p8d.fsf@alter.siamese.dyndns.org>

On Monday 07 December 2009, Junio C Hamano wrote:
> Johan Herland <johan@herland•net> writes:
> > Created by a simple cleanup and rename of lookup_notes().
> >
> > Signed-off-by: Johan Herland <johan@herland•net>
> > ---
> >  notes.c |   15 ++++++++-------
> >  notes.h |    3 +++
> >  2 files changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/notes.c b/notes.c
> > index 79bfa24..110404a 100644
> > --- a/notes.c
> > +++ b/notes.c
> > @@ -379,12 +379,13 @@ void add_note(const unsigned char *object_sha1,
> > const unsigned char *note_sha1) note_tree_insert(&root_node, 0, l,
> > PTR_TYPE_NOTE);
> >  }
> >
> > -static unsigned char *lookup_notes(const unsigned char *object_sha1)
> > +const unsigned char *get_note(const unsigned char *object_sha1)
> 
> Is there a need to find "note for this commit in the set of notes 3 days
> ago"?  IOW, reading note for the given commit not from the tip of the
> history of the refs/notes/commits but from say refs/notes/commits~4?
> Similarly, is there a need to ask for a history of notes for a given
> commit, something like "git log refs/notes/commit/$this_commit" in a
>  world without any fanout?
>
> Obviously, "there is no need because..." is the best answer I'd be happy
> with.  "There may be in the future but we haven't identified a good use
> case and we don't implement what we do not need now." is also perfectly
> acceptable.

There may be in the future but we haven't identified a good use case and we 
don't implement what we do not need now.

;)

> IOW, I am not suggesting to change it---I just want to know how much
> thought went in before deciding to implement the interface this way.

Well, this later part of the series (from patch #6) was built mainly to 
support the fast-import patch (which is no longer based on this API), but 
also with an eye towards keeping things fairly flexible and generic. 
Furthermore I expect to use most of these patches when I get around to 
builtin-ifying the git-notes shell script (which currently is oblivious the 
notes API and things like fanout and rebalancing).

In any case, if you look at patch #10/11, you'll see I introduce the concept 
of multiple notes trees. This was originally done to allow fast-import to 
edit notes in several branches simultaneously, but it now occurs to me that 
this is exactly what we need to answer your questions above: If you want to 
look at an older version of your notes tree, you simply instantiate another 
notes tree with:

	struct notes_tree my_notes;
	init_notes(my_notes, "refs/notes/commits~4", ...);

and you can now compare notes between my_notes and the current (or any 
other) notes tree.


Have fun! :)

...Johan

-- 
Johan Herland, <johan@herland•net>
www.herland.net

  reply	other threads:[~2009-12-08  3:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07 11:27 [RFC/PATCHv10 00/11] git notes Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 01/11] fast-import: Proper notes tree manipulation Johan Herland
2009-12-07 16:41   ` Shawn O. Pearce
2009-12-08  1:44     ` Johan Herland
2009-12-08  2:01       ` Shawn O. Pearce
2009-12-08  2:45         ` Johan Herland
2009-12-10  9:39           ` Johan Herland
2009-12-10 14:03             ` Shawn O. Pearce
2009-12-10 14:40               ` Johan Herland
2009-12-11  3:00                 ` Junio C Hamano
2009-12-07 16:43   ` Shawn O. Pearce
2009-12-08  1:55     ` Johan Herland
2009-12-08  1:59       ` Shawn O. Pearce
2009-12-07 20:42   ` Junio C Hamano
2009-12-08  2:34     ` Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 02/11] Rename t9301 to t9350, to make room for more fast-import tests Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 03/11] Add more testcases to test fast-import of notes Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 04/11] Minor style fixes to notes.c Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 05/11] Notes API: get_commit_notes() -> format_note() + remove the commit restriction Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 06/11] Notes API: init_notes(): Initialize the notes tree from the given notes ref Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 07/11] Notes API: add_note(): Add note objects to the internal notes tree structure Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 08/11] Notes API: get_note(): Return the note annotating the given object Johan Herland
2009-12-07 20:52   ` Junio C Hamano
2009-12-08  3:18     ` Johan Herland [this message]
2009-12-07 11:27 ` [RFC/PATCHv10 09/11] Notes API: for_each_note(): Traverse the entire notes tree with a callback Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 10/11] Notes API: Allow multiple concurrent notes trees with new struct notes_tree Johan Herland
2009-12-07 11:27 ` [RFC/PATCHv10 11/11] Refactor notes concatenation into a flexible interface for combining notes Johan Herland
2009-12-08  9:25 ` [RFC/PATCHv10 00/11] git notes Junio C Hamano

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=200912080418.06233.johan@herland.net \
    --to=johan@herland$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=spearce@spearce$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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