Subject: Re: [PATCH v6 2/4] trailer: move process_trailers to trailer.h

From: Junio C Hamano <[email-masked]>
Date: Wed, 05 Nov 2025 09:38:52 -0800

Li Chen <[email-masked]> writes:

> From: Li Chen <[email-masked]>
>
> This function would be used by trailer_process
> in following commits.

Please make sure that the body is understandable without the title
of the commit.  Are you going to use process_trailers() from
trailer_process()?  Can the pair be named less confusingly?

> Subject: Re: [PATCH v6 2/4] trailer: move process_trailers to trailer.h

Declaring a helper that used to be a file-scope static to a public
header file is better described as "make process_trailers() public".

> diff --git a/trailer.h b/trailer.h
> index 4740549586..44d406b763 100644
> --- a/trailer.h
> +++ b/trailer.h
> @@ -202,4 +202,7 @@ void trailer_iterator_release(struct trailer_iterator *iter);
>   */
>  int amend_file_with_trailers(const char *path, const struct strvec *trailer_args);
>  

Befero the function, instruct potential future callers what this
function is about, what parameters it expects, and what side effect
it makes.  As pointed out in the previous step, "sb" definitely has
to be renamed if this becomes public.

> +void process_trailers(const struct process_trailer_options *opts,
> +		      struct list_head *new_trailer_head,
> +		      struct strbuf *sb, struct strbuf *out);
>  #endif /* TRAILER_H */