treewide: drop USE_THE_REPOSITORY_VARIABLE

Adapt a couple of trivial callers of `is_bare_repository()` to instead use a repository available via the caller's context so that we can drop the `USE_THE_REPOSITORY_VARIABLE` macro. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jun 11, 2026 at 08:44 UTC 1ceee7431b40aba69707835b9b65b0ed7a9cb973
4 files changed +5 -11
builtin/repack.c
+1 -2
@@ -1,4 +1,3 @@
1 -#define USE_THE_REPOSITORY_VARIABLE
1 #define DISABLE_SIGN_COMPARE_WARNINGS
2
3 #include "builtin.h"
@@ -265,7 +264,7 @@ int cmd_repack(int argc,
264
265 if (write_bitmaps < 0) {
266 if (write_midx == REPACK_WRITE_MIDX_NONE &&
268 - (!(pack_everything & ALL_INTO_ONE) || !is_bare_repository(the_repository)))
267 + (!(pack_everything & ALL_INTO_ONE) || !is_bare_repository(repo)))
268 write_bitmaps = 0;
269 }
270 if (po_args.pack_kept_objects < 0)
mailmap.c
+2 -4
@@ -1,5 +1,3 @@
1 -#define USE_THE_REPOSITORY_VARIABLE
2 -
1 #include "git-compat-util.h"
2 #include "environment.h"
3 #include "string-list.h"
@@ -219,10 +217,10 @@ int read_mailmap(struct repository *repo, struct string_list *map)
217 map->strdup_strings = 1;
218 map->cmp = namemap_cmp;
219
222 - if (!mailmap_blob && is_bare_repository(the_repository))
220 + if (!mailmap_blob && is_bare_repository(repo))
221 mailmap_blob = xstrdup("HEAD:.mailmap");
222
225 - if (!startup_info->have_repository || !is_bare_repository(the_repository))
223 + if (!startup_info->have_repository || !is_bare_repository(repo))
224 err |= read_mailmap_file(map, ".mailmap",
225 startup_info->have_repository ?
226 MAILMAP_NOFOLLOW : 0);
refs/reftable-backend.c
+1 -3
@@ -1,5 +1,3 @@
1 -#define USE_THE_REPOSITORY_VARIABLE
2 -
1 #include "../git-compat-util.h"
2 #include "../abspath.h"
3 #include "../chdir-notify.h"
@@ -288,7 +286,7 @@ static int should_write_log(struct reftable_ref_store *refs, const char *refname
286 {
287 enum log_refs_config log_refs_cfg = refs->log_all_ref_updates;
288 if (log_refs_cfg == LOG_REFS_UNSET)
291 - log_refs_cfg = is_bare_repository(the_repository) ? LOG_REFS_NONE : LOG_REFS_NORMAL;
289 + log_refs_cfg = is_bare_repository(refs->base.repo) ? LOG_REFS_NONE : LOG_REFS_NORMAL;
290
291 switch (log_refs_cfg) {
292 case LOG_REFS_NONE:
setup.c
+1 -2
@@ -1,4 +1,3 @@
1 -#define USE_THE_REPOSITORY_VARIABLE
1 #define DISABLE_SIGN_COMPARE_WARNINGS
2
3 #include "git-compat-util.h"
@@ -2610,7 +2609,7 @@ static int create_default_files(struct repository *repo,
2609 }
2610 repo_config_set(repo, "core.filemode", filemode ? "true" : "false");
2611
2613 - if (is_bare_repository(the_repository))
2612 + if (is_bare_repository(repo))
2613 repo_config_set(repo, "core.bare", "true");
2614 else {
2615 repo_config_set(repo, "core.bare", "false");