Re: [PATCH v2 02/10] hook: provide stdin via callback
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 21, 2025, 07:41 UTC
- Message-ID
- <aPc5GhzFSdrMvOZK@pks.im>
- In-Reply-To
- <20251017141544.1538542-3-adrian.ratiu@collabora.com>
On Fri, Oct 17, 2025 at 05:15:36PM +0300, Adrian Ratiu wrote:
Show 30 quoted lines
> diff --git a/hook.h b/hook.h > index 11863fa734..ebe5dc450e 100644 > --- a/hook.h > +++ b/hook.h > @@ -37,6 +38,28 @@ struct run_hooks_opt > * Path to file which should be piped to stdin for each hook. > */ > const char *path_to_stdin; > + > + /** > + * Callback to ask for more content to pipe to each hook stdin. > + * > + * If a hook needs to consume large quantities of data (e.g. a > + * list of all refs received in a client push), feeding data via > + * in-memory strings or slurping to/from files via path_to_stdin > + * is inefficient, so this callback allows for piecemeal writes. > + * > + * Add initalization context to hook.feed_pipe_ctx. > + * > + * The caller owns hook.feed_pipe_ctx and has to release any > + * resources after hooks finish execution. > + */ > + feed_pipe_fn feed_pipe; > + void *feed_pipe_ctx; > + > + /** > + * Use this to keep internal state for your feed_pipe_fn callback. > + * Only useful when using run_hooks_opt.feed_pipe, otherwise ignore it. > + */ > + void *feed_pipe_cb_data;
Are these fields used as any of the callback arguments? If so, let's document which of the fields they correspond to, as it's otherwise hard to follow.
Patrick