Re: [Outreachy][Proposal]: Refactor in order to reduce Git’s global state
From: Bello Olamide <hidden>
Date: 2025-10-31 11:43:42
On Thu, 30 Oct 2025 at 13:55, Christian Couder [off-list ref] wrote:
quoted
Yes there were cases where the functions were adapted to use exactly what it needs down the call chain rather than writing new accessor functions. An example is https://public-inbox.org/git/20250306-b4-pks-objects-without-the-repository-v2-1-f3465327be69@pks.im/#Z31csum-file.h where the global variable `the_hash_algo` is replaced with an explicit parameter `const struct git_hash_algo *algo` in low-level functions such as `static struct hashfile *hashfd_internal()` and the call sites adapted to use r->hash_algo or the_repository->hash_algo in places where the subsystem has not gotten rid of `the-repository`. This is also a strategy that can be used to replace global variables.Your answers are appreciated, but, just to be clear, I think it would be nice if the answers to my questions like this one were part of a v2 of your proposal. If I don't see a v2, I am less tempted to discuss this further (which could hopefully help move the analysis forward and make your proposal better). Thanks.
Hello Christian Thank you very much. I have added the answers to your question and submitted a v2 of the proposal. Bello