builtin/refs: drop `the_repository`

We still have a couple of uses of `the_repository` in "builtin/refs.c". All of those are trivial to convert though as the command always requires a repository to exist. Convert them to use the passed-in repository and drop `USE_THE_REPOSITORY_VARIABLE`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jul 6, 2026 at 15:27 UTC 5a183de7114b0139a8a91a34c794e8be9cf9f851
1 file changed +7 -8
builtin/refs.c
+7 -8
@@ -1,4 +1,3 @@
1 -#define USE_THE_REPOSITORY_VARIABLE
1 #include "builtin.h"
2 #include "config.h"
3 #include "fsck.h"
@@ -23,7 +22,7 @@
22 N_("git refs optimize " PACK_REFS_OPTS)
23
24 static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
26 - struct repository *repo UNUSED)
25 + struct repository *repo)
26 {
27 const char * const migrate_usage[] = {
28 REFS_MIGRATE_USAGE,
@@ -59,13 +58,13 @@ static int cmd_refs_migrate(int argc, const char **argv, const char *prefix,
58 goto out;
59 }
60
62 - if (the_repository->ref_storage_format == format) {
61 + if (repo->ref_storage_format == format) {
62 err = error(_("repository already uses '%s' format"),
63 ref_storage_format_to_name(format));
64 goto out;
65 }
66
68 - if (repo_migrate_ref_storage_format(the_repository, format, flags, &errbuf) < 0) {
67 + if (repo_migrate_ref_storage_format(repo, format, flags, &errbuf) < 0) {
68 err = error("%s", errbuf.buf);
69 goto out;
70 }
@@ -99,8 +98,8 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix,
98 if (argc)
99 usage(_("'git refs verify' takes no arguments"));
100
102 - repo_config(the_repository, git_fsck_config, &fsck_refs_options);
103 - prepare_repo_settings(the_repository);
101 + repo_config(repo, git_fsck_config, &fsck_refs_options);
102 + prepare_repo_settings(repo);
103
104 worktrees = get_worktrees_without_reading_head();
105 for (size_t i = 0; worktrees[i]; i++)
@@ -124,7 +123,7 @@ static int cmd_refs_list(int argc, const char **argv, const char *prefix,
123 }
124
125 static int cmd_refs_exists(int argc, const char **argv, const char *prefix,
127 - struct repository *repo UNUSED)
126 + struct repository *repo)
127 {
128 struct strbuf unused_referent = STRBUF_INIT;
129 struct object_id unused_oid;
@@ -145,7 +144,7 @@ static int cmd_refs_exists(int argc, const char **argv, const char *prefix,
144 die(_("'git refs exists' requires a reference"));
145
146 ref = *argv++;
148 - if (refs_read_raw_ref(get_main_ref_store(the_repository), ref,
147 + if (refs_read_raw_ref(get_main_ref_store(repo), ref,
148 &unused_oid, &unused_referent, &unused_type,
149 &failure_errno)) {
150 if (failure_errno == ENOENT || failure_errno == EISDIR) {