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
Message-Id: robbat2-20090609T200056-797381285Z@orbis-terrarum.net
In Reply to: [gentoo-scm] New hooks for git, was: Progress summary, 2009/06/01 by Arun Raghavan
1 On Wed, Jun 10, 2009 at 01:12:47AM +0530, Arun Raghavan wrote:
2 > On Mon, 2009-06-01 at 16:45 -0700, Robin H. Johnson wrote:
3 > > - Finish new hooks for git:
4 > > upload-pack.c - get_common_commits:
5 > > right before the 'return 0', check for and launch a new hook,
6 > > passing
7 > > the have/want headers via stdin, and use the return code (AND the
8 > > stderr) to see if we should halt.
9 > Could you expand on this? Doesn't sound too complex - if I understand
10 > this, 'have' is the set of heads of branches that the server has and
11 > 'want' is the set of branches that the client figures it needs to update
12 > (simplifying a little from [1]).
13 - You'll have to replicate something like the run_receive_hook()
14 function (replace the body of the second for loop), maybe call it
15 run_upload_hook().
16 - Look at where upload-pack.c returns ACK/NAK presently.
17 - Add a means to run the hook function there. Be sure to pass stderr
18 back!
19 - See that get_common_commits sends stderr to the client (I think it
20 should handle this perfectly already).
21
22 > That said, when do we want to terminate the upload?
23 Basically, I see something like this (I've skipped the length parts of
24 the mesage, but see section 5.3 in the RFC):
25 C: want $ID\0...\n
26 C: ....
27 C: done\n
28 S: NAK\n
29 S: \002Please visit http://.... and use the bundle for the initial
30 download\n
31 S: (disconnect)
32
33 The client sent no 'have' blocks (either at all, or sufficiently new),
34 so we tell them to GTFO.
35
36 --
37 Robin Hugh Johnson
38 Gentoo Linux Developer & Infra Guy
39 E-Mail : robbat2@g.o
40 GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85