From: Karthik Nayak Date: Mon, 24 Aug 2026 08:14:47 GMT Subject: Re: [PATCH v2] hook: introduce the report hook for git-receive-pack(1) Message-ID: In-Reply-To: Patrick Steinhardt writes: > On Fri, Aug 21, 2026 at 09:08:12AM -0700, Karthik Nayak wrote: >> Patrick Steinhardt writes: >> > On Fri, Aug 21, 2026 at 03:34:58PM +0200, Karthik Nayak wrote: > [snip] >> >> +repository, but before the pkt-line encoded status report is sent back >> >> +to the client. >> >> + >> >> +The hook receives the complete pkt-line encoded status report on >> >> +standard input. The report begins with an `unpack` line indicating >> >> +whether the object transfer succeeded (`unpack ok` or >> >> +`unpack `), followed by one `ok ` or >> >> +`ng ` line per ref that was pushed, and is >> >> +terminated by a flush packet. >> >> + >> >> +The hook's standard output entirely replaces the report that is sent >> >> +to the client. The hook must write a valid pkt-line encoded report in >> >> +the same format it received. The hook's stdout is fully buffered by >> >> +`receive-pack` before any data is sent to the client, so the hook's >> >> +exit status is known before the client receives anything. >> >> + >> >> +There are two distinct ways the hook can affect the push outcome: >> >> + >> >> +* To reject individual ref updates while keeping `receive-pack` alive, >> >> + rewrite the corresponding `ok ` lines to >> >> + `ng ` lines in the output and exit with status 0. >> > >> > It's `ng [ ]`, right? I think the reason itself is >> > optional. We might also want to clarify whether there should be a >> > trailing newline or not. >> > >> >> You're right, since 'send-pack' will default to 'failed' if there is no >> reason. >> >> We do say 'terminated by a flush packed'. > > We only send the flush packet once donce with all refs though, right? > I was wondering about each individual reference line: are they supposed > to end with a newline or not? > > Patrick Ah, will clarify that :)