Duy Nguyen [off-list ref] writes:
quoted
4) eventually (in the very long run), we'd change the signature of
all commands from cmd_foo(int argc, char argv, char *prefix)
to cmd_foo(int argc, char argv, struct repository *repo)
you seem to be interested in removing the_repository from branch.c,
but not as much from bultin/ for now, which is roughly step 2 in that plan?
Yes. Though I think step 4 is to make setup_git_directory() and
enter_repo() return a 'struct repository *'. This means if you have
not called either function and not take the repo as an argument, you
do not have access to any repository.
That part is understandable if somewhat hand-wavy, but it is not
clear how you can lose the prefix and still keep things like
OPT_FILENAME() working correctly.
On Wed, Aug 15, 2018 at 7:38 PM Junio C Hamano [off-list ref] wrote:
Duy Nguyen [off-list ref] writes:
quoted
quoted
4) eventually (in the very long run), we'd change the signature of
all commands from cmd_foo(int argc, char argv, char *prefix)
to cmd_foo(int argc, char argv, struct repository *repo)
you seem to be interested in removing the_repository from branch.c,
but not as much from bultin/ for now, which is roughly step 2 in that plan?
Yes. Though I think step 4 is to make setup_git_directory() and
enter_repo() return a 'struct repository *'. This means if you have
not called either function and not take the repo as an argument, you
do not have access to any repository.
That part is understandable if somewhat hand-wavy, but it is not
clear how you can lose the prefix and still keep things like
OPT_FILENAME() working correctly.
I haven't worked it all out yet, but I think setup_git_directory()
could still return it either as a separate argument or inside 'struct
repository'. Then parse_options() still takes the prefix like now, or
take the struct repository (the latter may be better because there's
also other option callbacks that need struct repo).
--
Duy