Re: [PATCH 5/7] builtin/ls-files: stop using `the_repository`
From: Usman Akinyemi <hidden>
Date: 2025-02-17 08:57:25
On Mon, Feb 17, 2025 at 12:25 PM Patrick Steinhardt [off-list ref] wrote:
On Sat, Feb 15, 2025 at 04:27:21AM +0530, Usman Akinyemi wrote:quoted
Remove the_repository global variable in favor of the repository argument that gets passed in "builtin/ls-files.c". When `-h` is passed to the command outside a Git repository, the `run_builtin()` will call the `cmd_ls_files()` function with `repo` set to NULL and then early in the function, `show_usage_with_options_if_asked()` call will give the options help and exit, without having to consult much of the configuration file. Let's pass `repository` argument to `expand_objectsize()`, `show_ru_info()` functions to remove their dependency on the global `the_repository` variable.This paragraph made my reading hickup a bit. How about: Pass the repository available in the calling context to both `expand_objectsize()` and `show_ru_info()` to remove their dependency on the global `the_repository` variable.
Thanks for the suggestion, I will use it in the next version.
Patrick