]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/ls-files: stop using `the_repository`
authorUsman Akinyemi <usmanakinyemi202@gmail.com>
Fri, 7 Mar 2025 23:35:05 +0000 (05:05 +0530)
committerJunio C Hamano <gitster@pobox.com>
Sat, 8 Mar 2025 00:52:01 +0000 (16:52 -0800)
commitd9c5cfb18f4dff87db7d28846bd754c009f6043d
treedd3837e770d9883544a81a63ed26d345263abad3
parent72fe8bfac832a1f1b9b7cdc4efa793c48e13933e
builtin/ls-files: stop using `the_repository`

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.

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.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-files.c
t/t3004-ls-files-basic.sh