From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Tom Werner <mojombo@gmail.com>,
Tom Preston-Werner <tom@mojombo.com>,
git@vger.kernel.org
Subject: Re: [PATCH] upload-pack: add a trigger for post-upload-pack hook
Date: Tue, 25 Aug 2009 16:50:29 -0700 [thread overview]
Message-ID: <7vprajmp16.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20090825184525.GC23731@coredump.intra.peff.net> (Jeff King's message of "Tue\, 25 Aug 2009 14\:45\:25 -0400")
Jeff King <peff@peff.net> writes:
>> +static void run_post_upload_pack_hook(int create_full_pack)
>> +{
>> + const char *fetch_type;
>> + fetch_type = (create_full_pack) ? "clone" : "fetch";
>> + run_hook(get_index_file(), "post-upload-pack", fetch_type);
>> +}
>
> Does it really need an index file? This operation in question seems to
> be totally disconnected from the index (and indeed, most bare
> repositories won't even have one). Probably it should pass NULL as the
> initial argument to run_hook.
Very good point; a bare repository does not have to have (and typically
shouldn't have) the index, and a bare repository is what upload-pack
typically serves.
A short-and-sweet:
run_hook(NULL, "post-upload-pack",
create_full_pack ? "clone" : "fetch,
NULL);
would be sufficient. Notice that run_hook() is variadic and its argument
list needs to be terminated with NULL (iow, the original patch is buggy
and risks reading random places on the stack---I would recommend against
using it on your production site yet).
> Is there any other information that might be useful to other non-GitHub
> users of the hook? The only thing I can think of is the list of refs
> that were fetched.
I do not think that information is available. "want" will tell you what
object they want, but that does not necessarily uniquey translate to a
ref.
If we are allowed to talk about asking for the moon, and if one of the
primary reason for this new hook is statistics, it would be useful to see
the number of bytes given, where the fetch-pack came from, and if we are
using git-daemon virtual hosting which of our domain served the request.
next prev parent reply other threads:[~2009-08-25 23:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-18 7:04 [PATCH] upload-pack: add a trigger for post-upload-pack hook Tom Preston-Werner
2009-08-25 17:43 ` Tom Werner
2009-08-25 18:45 ` Jeff King
2009-08-25 23:50 ` Junio C Hamano [this message]
2009-08-26 8:44 ` Johannes Schindelin
2009-08-26 9:03 ` Junio C Hamano
2009-08-26 10:06 ` Johannes Schindelin
2009-08-26 14:19 ` Jeff King
2009-08-26 23:39 ` Junio C Hamano
2009-08-27 0:47 ` Junio C Hamano
2009-08-27 12:09 ` Johan Sørensen
2009-08-27 13:33 ` Jakub Narebski
2009-08-29 6:17 ` Junio C Hamano
2009-08-31 18:50 ` Tom Werner
2009-08-31 23:36 ` Junio C Hamano
2009-08-27 22:56 ` Robin H. Johnson
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=7vprajmp16.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mojombo@gmail.com \
--cc=peff@peff.net \
--cc=tom@mojombo.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).