Karthik Nayak via B4 Relay <devnull+karthik.188.gmail.com@xxxxxxxxxx> writes: > From: Karthik Nayak <karthik.188@xxxxxxxxx> > > 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 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. OK, so the aim is to make a bug-to-bug compatible rewrite at this step. We used to use the_hash_algo at the lowermost callee, so have it take a hash_algo as parameter, but have everybody pass the_hash_algo to it, even though a caller might have a more "suitable" hash_algo for the data it is feeding the lower layer. Which makes sense. Naturally, as we are producing pack stream, we ought to have an idea on what hash function is in use to name these objects in the pack stream and the hash function used at the csum-file level, so all callers ought to have the information eventually (and if some of them are relying on the_hash_algo currently, they need to be fixed). All of that can be left for some future date and blindly passing down the_hash_algo from all callers in this patch is a good approach to establish a solid foundation to build on.