Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com,
	kristofferhaugsbakk@fastmail.com,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v2] hook: introduce the report hook for git-receive-pack(1)
Date: Mon, 24 Aug 2026 07:32:32 +0200	[thread overview]
Message-ID: <aovXcPHCiBPxlLXo@pks.im> (raw)
In-Reply-To: <CAOLa=ZTkW14coLA4st-m6B6P-9pUr+Yzh7Ph6nb0ohXJSbTk4A@mail.gmail.com>

On Fri, Aug 21, 2026 at 09:08:12AM -0700, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> 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 <error>`), followed by one `ok <refname>` or
> >> +`ng <refname> <reason>` 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 <refname>` lines to
> >> +  `ng <refname> <reason>` lines in the output and exit with status 0.
> >
> > It's `ng <refname>[ <reason>]`, 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

  reply	other threads:[~2026-08-24  5:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18  7:55 [PATCH] hook: introduce the report hook for git-receive-pack(1) Karthik Nayak
2026-08-18 20:54 ` Junio C Hamano
2026-08-19  7:03 ` Kristoffer Haugsbakk
2026-08-19 12:11   ` Karthik Nayak
2026-08-19 14:47     ` Kristoffer Haugsbakk
2026-08-19  7:39 ` Patrick Steinhardt
2026-08-19 13:13   ` Karthik Nayak
2026-08-19 13:20     ` Patrick Steinhardt
2026-08-19 13:24       ` Karthik Nayak
2026-08-20  9:50 ` Phillip Wood
2026-08-20 15:43   ` Junio C Hamano
2026-08-21 12:51   ` Karthik Nayak
2026-08-21 13:34 ` [PATCH v2] " Karthik Nayak
2026-08-21 13:49   ` Patrick Steinhardt
2026-08-21 16:08     ` Karthik Nayak
2026-08-24  5:32       ` Patrick Steinhardt [this message]
2026-08-24  8:14         ` Karthik Nayak
2026-08-21 16:55     ` Junio C Hamano
2026-08-24 10:20 ` [PATCH v3 0/3] " Karthik Nayak
2026-08-24 10:20   ` [PATCH v3 1/3] doc: add proc-receive hook info in 'git-receive-pack.adoc' Karthik Nayak
2026-08-24 10:21   ` [PATCH v3 2/3] receive-pack: move message generation to separate function Karthik Nayak
2026-08-24 10:21   ` [PATCH v3 3/3] hook: introduce the report hook for git-receive-pack(1) Karthik Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aovXcPHCiBPxlLXo@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=karthik.188@gmail.com \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox