git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] upload-pack: add a trigger for post-upload-pack hook

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 25, 2009, 23:50 UTC
Message-ID
<7vprajmp16.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20090825184525.GC23731@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
>> +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.

Previous: Jeff KingNext: Johannes Schindelin
Message 4 of 16 in “upload-pack: add a trigger for post-upload-pack hook”
  1. upload-pack: add a trigger for post-upload-pack hookTom Preston-Werner, Aug 18, 2009
  2. Tom WernerAug 25, 2009
  3. Jeff KingAug 25, 2009
  4. Junio C HamanoAug 25, 2009
  5. Johannes SchindelinAug 26, 2009
  6. Junio C HamanoAug 26, 2009
  7. Johannes SchindelinAug 26, 2009
  8. Jeff KingAug 26, 2009
  9. Junio C HamanoAug 26, 2009
  10. upload-pack: add a trigger for post-upload-pack hookJunio C Hamano, Aug 27, 2009
  11. Johan SørensenAug 27, 2009
  12. Jakub NarebskiAug 27, 2009
  13. Junio C HamanoAug 29, 2009
  14. Tom WernerAug 31, 2009
  15. Junio C HamanoAug 31, 2009
  16. Robin H. JohnsonAug 27, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.