Re: [PATCH v3 8/8] builtin/checkout-index: stop using `the_repository`
- From
Usman Akinyemi <usmanakinyemi202@gmail.com>
- Date
- Mar 7, 2025, 01:15 UTC
- Message-ID
- <CAPSxiM_fLNUvg86TtCHZTbsE_VnhKdMiDa3pfLPsLa3ThZfxmw@mail.gmail.com>
- In-Reply-To
- <xmqqzfhyggzb.fsf@gitster.g>
On Thu, Mar 6, 2025 at 11:48 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
> > Usman Akinyemi <usmanakinyemi202@gmail.com> writes: > > > Remove the_repository global variable in favor of the repository > > argument that gets passed in "builtin/checkout-index.c". > > > > When `-h` is passed to the command outside a Git repository, the > > `run_builtin()` will call the `cmd_checkout_index()` 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. > > > > Pass the repository available in the calling context to both `checkout_all()` > > and `checkout_file()` to remove their dependency on the global > > `the_repository` variable. > > Hmph, if we are passing anything down to these code paths, I would > have expected that it would be an instance of "struct index_state". > > Do these two helper functions need anything other than that from the > repository instance?
No, they do not. They could possibly do in the future and is there any reason why we might want to pass the "struct index_state" instead of the whole "struct repository" ?
Show 6 quoted lines
> > Other than that, I think this step does look great. > > Will queue. > > Thanks.