]> git.ipfire.org Git - thirdparty/git.git/commit
pack-write: pass hash_algo to `write_rev_file()`
authorKarthik Nayak <karthik.188@gmail.com>
Sun, 19 Jan 2025 11:19:29 +0000 (12:19 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Jan 2025 20:36:34 +0000 (12:36 -0800)
commit6b2aa7fd371c93df44cebff072bef193104f43f8
tree45157097b4219f3697865c7b266f567c33c7d91c
parent7653e9af9b9ddfc465df50203c78f5c8569d8c79
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>
builtin/index-pack.c
midx-write.c
pack-write.c
pack.h