From: Shawn O. Pearce Date: Wed, 07 Mar 2007 17:09:04 GMT Subject: Re: Git push failure with update hook success Message-ID: <20070307170904.GB27922@spearce.org> In-Reply-To: <17902.60536.5890.608883@lisa.zopyra.com> Bill Lear wrote: > On Wednesday, March 7, 2007 at 10:29:29 (-0600) Bill Lear writes: > >... > >whether it might be better to call the update hook after everything > >had actually been written, including the log file. > > I dug into the code: in receive-pack.c, the command 'update(struct > command *cmd)', calls write_ref_sha1() after run_update_hook() > and does not check the return code of write_ref_sha1(). Please see the patch I just posted (and CC'd you on). We should have caught the return error of write_ref_sha1, the patch now does that. :) You probably want to use the post-update hook to send email. This hook will always run if it exists and is executable, but it won't be given a ref that failed to be updated. Of course an unfortunate downside to the post-update hook is it does not receive the old SHA-1 of the ref; it just gets the ref name. -- Shawn.