Subject: Re: [PATCH v4 01/29] trailer: append trailers in-process and drop the fork to `interpret-trailers`

From: "Kristoffer Haugsbakk" <[email-masked]>
Date: Tue, 14 Oct 2025 22:43:09 +0200

On Tue, Oct 14, 2025, at 14:24, Li Chen wrote:
> From: Li Chen <[email-masked]>
>
> Route all trailer insertion through trailer_process() and make
> builtin/interpret-trailers just do file I/O before calling into it.
> amend_file_with_trailers() now shares the same code path.
>
> This removes the fork/exec and tempfile juggling, cutting overhead and
> simplifying error handling. No functional change is intended. It also

Why “is intended” instead of “No functional change.”?

> centralizes logic to prepare for follow-up rebase --trailer patch.
>
> Signed-off-by: Li Chen <[email-masked]>
> ---
>  builtin/interpret-trailers.c | 116 ++++++++------------------------
>  trailer.c                    | 125 ++++++++++++++++++++++++++++++++---
>  trailer.h                    |  18 ++++-
>  3 files changed, 157 insertions(+), 102 deletions(-)
>[...]
>  	new_trailers_clear(&trailers);
> diff --git a/trailer.c b/trailer.c
> index 911a81ed99..8aec466b5f 100644
> --- a/trailer.c
> +++ b/trailer.c
> @@ -1224,14 +1224,121 @@ void trailer_iterator_release(struct
> trailer_iterator *iter)
>  	strbuf_release(&iter->key);
>  }
>
> -int amend_file_with_trailers(const char *path, const struct strvec
> *trailer_args)
> +static int amend_strbuf_with_trailers(struct strbuf *buf,
> +									  const struct strvec *trailer_args)

This needs Clang formatting.

>  {
> -	struct child_process run_trailer = CHILD_PROCESS_INIT;
>[snip]