]> git.ipfire.org Git - thirdparty/git.git/commit
midx-write: pass down repository to static functions
authorKarthik Nayak <karthik.188@gmail.com>
Wed, 27 Nov 2024 16:28:26 +0000 (17:28 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Dec 2024 01:32:20 +0000 (10:32 +0900)
commit3687a4b3e1c8edac080480677f35a5d267fee6e1
tree55a80a82469b8f4d24be4d9b171ca3f2ae50f31e
parentaaafb67ba92939125d909166e74eb36a1e652fd4
midx-write: pass down repository to static functions

In 'midx-write.c' there are a lot of static functions which use global
variables `the_repository` or `the_hash_algo`. In a follow up commit,
the repository variable will be added to `write_midx_context`, which
some of the functions can use. But for functions which do not have
access to this struct, pass down the required information from
non-static functions `write_midx_file` and `write_midx_file_only`.

This requires that the function `hash_to_hex` is also replaced with
`hash_to_hex_algop` since the former internally accesses the
`the_hash_algo` global variable.

This ensures that the usage of global variables is limited to these
non-static functions, which will be cleaned up in a follow up commit.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx-write.c