Subject: Re: [PATCH 2/4] refs: simplify logic when migrating reflog entries

From: Junio C Hamano <[email-masked]>
Date: Mon, 28 Jul 2025 09:21:23 -0700

Patrick Steinhardt <[email-masked]> writes:

> Move the index into `struct migration_data` and drop the now-unused
> `struct reflog_migration_data` to simplify the code a bit.

Nice.

> @@ -3015,17 +3008,8 @@ static int migrate_one_reflog_entry(const char *refname,
>  static int migrate_one_reflog(const char *refname, void *cb_data)
>  {
>  	struct migration_data *migration_data = cb_data;
> -	struct reflog_migration_data data = {
> -		.old_refs = migration_data->old_refs,
> -		.transaction = migration_data->transaction,
> -		.errbuf = migration_data->errbuf,
> -		.sb = &migration_data->sb,
> -		.name = &migration_data->name,
> -		.mail = &migration_data->mail,
> -	};

We no longer make this copy, which makes sense.

>  	return refs_for_each_reflog_ent(migration_data->old_refs, refname,
> -					migrate_one_reflog_entry, &data);
> +					migrate_one_reflog_entry, migration_data);
>  }