Re: [PATCH 2/8] midx-write: add repository field to `write_midx_context`
From: Patrick Steinhardt <hidden>
Date: 2024-11-18 08:06:07
From: Patrick Steinhardt <hidden>
Date: 2024-11-18 08:06:07
On Fri, Nov 15, 2024 at 02:42:15PM +0100, Karthik Nayak wrote:
@@ -651,9 +653,10 @@ static void write_midx_reverse_index(char *midx_name, unsigned char *midx_hash, struct strbuf buf = STRBUF_INIT; char *tmp_file; - trace2_region_enter("midx", "write_midx_reverse_index", the_repository); + trace2_region_enter("midx", "write_midx_reverse_index", ctx->repo); - strbuf_addf(&buf, "%s-%s.rev", midx_name, hash_to_hex(midx_hash)); + strbuf_addf(&buf, "%s-%s.rev", midx_name, hash_to_hex_algop(midx_hash, + ctx->repo->hash_algo)); tmp_file = write_rev_file_order(NULL, ctx->pack_order, ctx->entries_nr, midx_hash, WRITE_REV);
I think it would be nice to split up the changes that start to pass down a repo via the context and those that start to actually call a different function like we have here. Otherwise it's hard to spot the callsites where one actually has to think about what's happening. Patrick