midx-write: pass down repository to write_midx_file[_only]

In a previous commit, we passed the repository field to all
subcommands in the `builtin/` directory. Utilize this to pass the
repository field down to the `write_midx_file[_only]` functions to
remove the usage of `the_repository` global variables.

With this, all usage of global variables in `midx-write.c` is removed,
hence, remove the `USE_THE_REPOSITORY_VARIABLE` guard from the file.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Karthik Nayak
2024-11-27 17:28:29 +01:00
committed by Junio C Hamano
parent dfa7c68245
commit 2fed09aa9b
4 changed files with 17 additions and 23 deletions

View File

@ -120,7 +120,7 @@ static void read_packs_from_stdin(struct string_list *to)
static int cmd_multi_pack_index_write(int argc, const char **argv,
const char *prefix,
struct repository *repo UNUSED)
struct repository *repo)
{
struct option *options;
static struct option builtin_multi_pack_index_write_options[] = {
@ -165,7 +165,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
read_packs_from_stdin(&packs);
ret = write_midx_file_only(opts.object_dir, &packs,
ret = write_midx_file_only(repo, opts.object_dir, &packs,
opts.preferred_pack,
opts.refs_snapshot, opts.flags);
@ -176,7 +176,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
}
ret = write_midx_file(opts.object_dir, opts.preferred_pack,
ret = write_midx_file(repo, opts.object_dir, opts.preferred_pack,
opts.refs_snapshot, opts.flags);
free(opts.refs_snapshot);