diff options
| author | Karthik Nayak <karthik.188@gmail.com> | 2025-01-19 12:19:29 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-01-21 12:36:34 -0800 |
| commit | 6b2aa7fd371c93df44cebff072bef193104f43f8 (patch) | |
| tree | 45157097b4219f3697865c7b266f567c33c7d91c /midx-write.c | |
| parent | pack-write: pass hash_algo to `write_idx_file()` (diff) | |
| download | git-6b2aa7fd371c93df44cebff072bef193104f43f8.tar.gz git-6b2aa7fd371c93df44cebff072bef193104f43f8.zip | |
pack-write: pass hash_algo to `write_rev_file()`
The `write_rev_file()` function uses the global `the_hash_algo` variable
to access the repository's hash_algo. To avoid global variable usage,
pass a hash_algo from the layers above. Also modify children functions
`write_rev_file_order()` and `write_rev_header()` to accept
'the_hash_algo'.
Altough the layers above could have access to the hash_algo internally,
simply pass in `the_hash_algo`. This avoids any compatibility issues and
bubbles up global variable usage to upper layers which can be eventually
resolved.
However, in `midx-write.c`, since all usage of global variables is
removed, don't reintroduce them and instead use the `repo` available in
the context.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx-write.c')
| -rw-r--r-- | midx-write.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/midx-write.c b/midx-write.c index 0066594fa6..633fa16773 100644 --- a/midx-write.c +++ b/midx-write.c @@ -658,8 +658,8 @@ static void write_midx_reverse_index(char *midx_name, unsigned char *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); + tmp_file = write_rev_file_order(ctx->repo->hash_algo, NULL, ctx->pack_order, + ctx->entries_nr, midx_hash, WRITE_REV); if (finalize_object_file(tmp_file, buf.buf)) die(_("cannot store reverse index file")); |
