Subject: Re: [PATCH v4 5/8] refs: add `committer_info` to `ref_transaction_add_update()`

From: Toon Claes <[email-masked]>
Date: Thu, 19 Dec 2024 20:30:10 +0100

Karthik Nayak <[email-masked]> writes:

> The `ref_transaction_add_update()` creates the `ref_update` struct. To
> facilitate addition of reflogs in the next commit, the function needs to
> accommodate setting the `committer_info` field in the struct. So modify
> the function to also take `committer_info` as an argument and set it
> accordingly.
>
> Signed-off-by: Karthik Nayak <[email-masked]>
> ---
>  refs.c                  |  7 +++++--
>  refs/files-backend.c    | 14 ++++++++------
>  refs/refs-internal.h    |  1 +
>  refs/reftable-backend.c |  6 ++++--
>  4 files changed, 18 insertions(+), 10 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 9c9f4940c60d3cdd34ce8f1e668d17b9da3cd801..782bf1090af65196263a3c35ed18d878bb4f2967 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1166,6 +1166,7 @@ struct ref_update *ref_transaction_add_update(
>  		const struct object_id *new_oid,
>  		const struct object_id *old_oid,
>  		const char *new_target, const char *old_target,
> +		const char *committer_info,
>  		const char *msg)
>  {
>  	struct ref_update *update;
> @@ -1190,8 +1191,10 @@ struct ref_update *ref_transaction_add_update(
>  		oidcpy(&update->new_oid, new_oid);
>  	if ((flags & REF_HAVE_OLD) && old_oid)
>  		oidcpy(&update->old_oid, old_oid);
> -	if (!(flags & REF_SKIP_CREATE_REFLOG))
> +	if (!(flags & REF_SKIP_CREATE_REFLOG)) {
> +		update->committer_info = xstrdup_or_null(committer_info);

Why only include the committer_info when we're not skipping reflog
updates?

-- 
Toon