mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
builtin: pass repository to sub commands
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'.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
6ea2d9d271
commit
6f33d8e255
@@ -19,7 +19,8 @@ static const char * const builtin_hook_run_usage[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static int run(int argc, const char **argv, const char *prefix)
|
||||
static int run(int argc, const char **argv, const char *prefix,
|
||||
struct repository *repo UNUSED)
|
||||
{
|
||||
int i;
|
||||
struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT;
|
||||
@@ -70,7 +71,7 @@ usage:
|
||||
int cmd_hook(int argc,
|
||||
const char **argv,
|
||||
const char *prefix,
|
||||
struct repository *repo UNUSED)
|
||||
struct repository *repo)
|
||||
{
|
||||
parse_opt_subcommand_fn *fn = NULL;
|
||||
struct option builtin_hook_options[] = {
|
||||
@@ -81,5 +82,5 @@ int cmd_hook(int argc,
|
||||
argc = parse_options(argc, argv, NULL, builtin_hook_options,
|
||||
builtin_hook_usage, 0);
|
||||
|
||||
return fn(argc, argv, prefix);
|
||||
return fn(argc, argv, prefix, repo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user