Gentoo Archives: gentoo-scm

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-scm@l.g.o
Subject: Re: [gentoo-scm] New hooks for git, was: Progress summary, 2009/06/01
Date: Tue, 09 Jun 2009 20:17:04
In Reply to: [gentoo-scm] New hooks for git, was: Progress summary, 2009/06/01 by Arun Raghavan
On Wed, Jun 10, 2009 at 01:12:47AM +0530, Arun Raghavan wrote:
> On Mon, 2009-06-01 at 16:45 -0700, Robin H. Johnson wrote: > > - Finish new hooks for git: > > upload-pack.c - get_common_commits: > > right before the 'return 0', check for and launch a new hook, > > passing > > the have/want headers via stdin, and use the return code (AND the > > stderr) to see if we should halt. > Could you expand on this? Doesn't sound too complex - if I understand > this, 'have' is the set of heads of branches that the server has and > 'want' is the set of branches that the client figures it needs to update > (simplifying a little from [1]).
- You'll have to replicate something like the run_receive_hook() function (replace the body of the second for loop), maybe call it run_upload_hook(). - Look at where upload-pack.c returns ACK/NAK presently. - Add a means to run the hook function there. Be sure to pass stderr back! - See that get_common_commits sends stderr to the client (I think it should handle this perfectly already).
> That said, when do we want to terminate the upload?
Basically, I see something like this (I've skipped the length parts of the mesage, but see section 5.3 in the RFC): C: want $ID\0...\n C: .... C: done\n S: NAK\n S: \002Please visit http://.... and use the bundle for the initial download\n S: (disconnect) The client sent no 'have' blocks (either at all, or sufficiently new), so we tell them to GTFO. -- Robin Hugh Johnson Gentoo Linux Developer & Infra Guy E-Mail : robbat2@g.o GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85