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

Re: [PATCH 5/5] Teach receive-pack to run pre-receive/post-receive hooks

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 8, 2007, 03:34 UTC
Message-ID
<20070308033434.GA29567@spearce.org>
In-Reply-To
<7vbqj4eh9h.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 8 quoted lines
> Linus Torvalds <torvalds@linux-foundation.org> writes:
> 
> > Can you give a concise explanation of how "pre-receive" differ from the 
> > old "update", and how does "post-receive" differ from the old 
> > "post-update"?
> 
> They are somewhat redundant.  They get everything at once,
> unlike update hook.

Also unlike update hook, pre-receive rejects or accepts the entire batch of refs and cannot reject an individual ref update.

I would have removed post-update, but users depend on it. I would have modified its argument structure to be like post-receive, but again, users might depend on the current argument arrangement.

Show 7 quoted lines
> The old interface is adequate to do the same thing if you
> arrange them so that update hook notes which refs (with what old
> sha1 value it had) were asked to be updated, and make your
> post-update hook (which gets the names of refs) notice if some
> of them failed and from what ref a successful update happened.
> But getting everything at once is sometimes easier to work
> with.

Except that doing that is horribly ugly, as there are no locks held by receive-pack to help the hook author, so the hook author must dump that data out to a temporary file and be sure the post-update hook knows which file to look at, which it can't really know... a mess.

-- 
Shawn.
Previous: Junio C Hamano
Message 4 of 4 in “Teach receive-pack to run pre-receive/post-receive hooks”
  1. 5/5 Teach receive-pack to run pre-receive/post-receive hooksShawn O. Pearce, Mar 7, 2007
  2. Linus TorvaldsMar 7, 2007
  3. Junio C HamanoMar 8, 2007
  4. Shawn O. PearceMar 8, 2007

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.