From: Patrick Steinhardt Date: Tue, 21 Oct 2025 07:41:31 GMT Subject: Re: [PATCH v2 10/10] receive-pack: convert receive hooks to hook API Message-ID: In-Reply-To: <20251017141544.1538542-11-adrian.ratiu@collabora.com> On Fri, Oct 17, 2025 at 05:15:44PM +0300, Adrian Ratiu wrote: > diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c > index 93b6f28662..18b5f22d44 100644 > --- a/builtin/receive-pack.c > +++ b/builtin/receive-pack.c [snip] > +static int feed_receive_hook(int hook_stdin_fd, struct receive_hook_feed_state *state, int lines_batch_size) The `lines_batch_size` can be unsigned. > { > - struct child_process proc = CHILD_PROCESS_INIT; > - struct async muxer; > - int code; > - const char *hook_path = find_hook(the_repository, hook_name); > + struct command *cmd = state->cmd; > > - if (!hook_path) > - return 0; > + strbuf_reset(&state->buf); > > - strvec_push(&proc.args, hook_path); > - proc.in = -1; > - proc.stdout_to_stderr = 1; > - proc.trace2_hook_name = hook_name; > - > - if (feed_state->push_options) { > - size_t i; > - for (i = 0; i < feed_state->push_options->nr; i++) > - strvec_pushf(&proc.env, > - "GIT_PUSH_OPTION_%"PRIuMAX"=%s", > - (uintmax_t)i, > - feed_state->push_options->items[i].string); > - strvec_pushf(&proc.env, "GIT_PUSH_OPTION_COUNT=%"PRIuMAX"", > - (uintmax_t)feed_state->push_options->nr); > - } else > - strvec_pushf(&proc.env, "GIT_PUSH_OPTION_COUNT"); > + /* batch lines to avoid going through run-command's ppoll for each line */ > + for (int i = 0; i < lines_batch_size; i++) { And if so, the index here should be unsigned, as well. Patrick