pack-write: pass hash_algo to fixup_pack_header_footer()
The `fixup_pack_header_footer()` function uses the global `the_hash_algo` variable to access the repository's hash function. To avoid global variable usage, pass a hash_algo from the layers above. 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. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
fbe8d3079d
commit
8244d01de6
@@ -1387,7 +1387,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
|
||||
strbuf_release(&msg);
|
||||
finalize_hashfile(f, tail_hash, FSYNC_COMPONENT_PACK, 0);
|
||||
hashcpy(read_hash, pack_hash, the_repository->hash_algo);
|
||||
fixup_pack_header_footer(output_fd, pack_hash,
|
||||
fixup_pack_header_footer(the_hash_algo, output_fd, pack_hash,
|
||||
curr_pack, nr_objects,
|
||||
read_hash, consumed_bytes-the_hash_algo->rawsz);
|
||||
if (!hasheq(read_hash, tail_hash, the_repository->hash_algo))
|
||||
|
||||
Reference in New Issue
Block a user