From: Johan Herland Date: Thu, 08 Sep 2011 09:31:58 GMT Subject: Re: [PATCH 5/2] push -s: receiving end Message-ID: <201109081131.58362.johan@herland.net> In-Reply-To: <7v7h5jzj8o.fsf_-_@alter.siamese.dyndns.org> On Thursday 8. September 2011, Junio C Hamano wrote: > This stores the GPG signed push certificate in the receiving > repository using the notes mechanism. The certificate is appended to > a note in the refs/notes/signed-push tree for each object that > appears on the right hand side of the push certificate, i.e. the > object that was pushed to update the tip of a ref. > > Signed-off-by: Junio C Hamano > --- (...) > diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c > index 307fc3b..257f2a5 100644 > --- a/builtin/receive-pack.c > +++ b/builtin/receive-pack.c > @@ -156,6 +161,7 @@ struct command { > }; > > static const char pre_receive_hook[] = "hooks/pre-receive"; > +static const char pre_receive_signature_hook[] = > "hooks/pre-receive-signature"; static const char post_receive_hook[] > = "hooks/post-receive"; > > static void rp_error(const char *err, ...) __attribute__((format > (printf, 1, 2))); @@ -581,6 +587,22 @@ static void > check_aliased_updates(struct command *commands) > string_list_clear(&ref_list, 0); > } > > +static void get_note_text(struct strbuf *buf, struct notes_tree *t, > + const unsigned char *object) > +{ > + const unsigned char *sha1 = get_note(t, object); > + char *text; > + unsigned long len; > + enum object_type type; > + > + if (!sha1) > + return; > + text = read_sha1_file(sha1, &type, &len); > + if (text && len && type == OBJ_BLOB) > + strbuf_add(buf, text, len); > + free(text); > +} > + What about adding this function to notes.h as a convenience to other users of the notes API? Otherwise the code looks good to me. Have fun! :) ...Johan -- Johan Herland, www.herland.net