On Thu, Jan 16, 2025 at 12:35:16PM +0100, Karthik Nayak via B4 Relay wrote: > From: Karthik Nayak <karthik.188@xxxxxxxxx> > > The `write_rev_file()` function uses the global `the_hash_algo` variable > to access the repository's hash function. To avoid global variable > usage, let's pass the hash function from the layers above. > > Altough the layers above could have access to the hash function > 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. Yeah, this feels quite sensible. We know this file is supposedly `the_repository`-clean, and callers expect it to be, so reintroducing it wouldn't be sensible. Patrick