On Mon, Nov 25, 2024 at 03:55:30PM +0100, Karthik Nayak wrote: > In 9b1cb5070f (builtin: add a repository parameter for builtin > functions, 2024-09-13) the repository was passed down to all builtin > commands. This allowed the repository to be passed down to lower layers > without depending on the global `the_repository` variable. > > Continue this work by also passing down the repository parameter from > the command to sub-commands. This will help pass down the repository to > other subsystems and cleanup usage of global variables like > 'the_repository' and 'the_hash_algo'. One alternative could be to instead pass a caller-provided structure to the subcommands. Right now that isn't really needed because we tend to make use of not only `the_repository` as a global variable, but also because we track all kinds of other variables globally. So if the code were refactored to instead accept an arbitrary `void *` pointer, callers could provide a custom structure and pass that along to its subcommands. In many cases we may end up just passing the repo directly, but I'm sure there are others where this direction would buy us additional flexibility and allow us to get rid of even more global state. Patrick