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
@ -67,7 +67,8 @@ static int parse_options_cmd_bundle(int argc,
|
||||
return argc;
|
||||
}
|
||||
|
||||
static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
|
||||
static int cmd_bundle_create(int argc, const char **argv, const char *prefix,
|
||||
struct repository *repo UNUSED) {
|
||||
struct strvec pack_opts = STRVEC_INIT;
|
||||
int version = -1;
|
||||
int ret;
|
||||
@ -123,7 +124,8 @@ static int open_bundle(const char *path, struct bundle_header *header,
|
||||
return read_bundle_header(path, header);
|
||||
}
|
||||
|
||||
static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
|
||||
static int cmd_bundle_verify(int argc, const char **argv, const char *prefix,
|
||||
struct repository *repo UNUSED) {
|
||||
struct bundle_header header = BUNDLE_HEADER_INIT;
|
||||
int bundle_fd = -1;
|
||||
int quiet = 0;
|
||||
@ -164,7 +166,8 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix) {
|
||||
static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix,
|
||||
struct repository *repo UNUSED) {
|
||||
struct bundle_header header = BUNDLE_HEADER_INIT;
|
||||
int bundle_fd = -1;
|
||||
int ret;
|
||||
@ -189,7 +192,8 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix) {
|
||||
static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix,
|
||||
struct repository *repo UNUSED) {
|
||||
struct bundle_header header = BUNDLE_HEADER_INIT;
|
||||
int bundle_fd = -1;
|
||||
int ret;
|
||||
@ -231,7 +235,7 @@ cleanup:
|
||||
int cmd_bundle(int argc,
|
||||
const char **argv,
|
||||
const char *prefix,
|
||||
struct repository *repo UNUSED)
|
||||
struct repository *repo)
|
||||
{
|
||||
parse_opt_subcommand_fn *fn = NULL;
|
||||
struct option options[] = {
|
||||
@ -247,5 +251,5 @@ int cmd_bundle(int argc,
|
||||
|
||||
packet_trace_identity("bundle");
|
||||
|
||||
return !!fn(argc, argv, prefix);
|
||||
return !!fn(argc, argv, prefix, repo);
|
||||
}
|
||||
|
Reference in New Issue
Block a user