refs: stop using `the_repository`

Convert "refs.c" to stop using `the_repository` in favor of the repo that gets passed in via `struct ref_store`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jul 30, 2024 at 07:22 UTC f777f4d88440e9f04476a115a82809de19efc926
1 file changed +5 -7
refs.c
+5 -7
@@ -2,8 +2,6 @@
2 * The backend-independent part of the reference module.
3 */
4
5 -#define USE_THE_REPOSITORY_VARIABLE
6 -
5 #include "git-compat-util.h"
6 #include "advice.h"
7 #include "config.h"
@@ -1838,7 +1836,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
1836 failure_errno != ENOTDIR)
1837 return NULL;
1838
1841 - oidclr(oid, the_repository->hash_algo);
1839 + oidclr(oid, refs->repo->hash_algo);
1840 if (*flags & REF_BAD_NAME)
1841 *flags |= REF_ISBROKEN;
1842 return refname;
@@ -1848,7 +1846,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
1846
1847 if (!(read_flags & REF_ISSYMREF)) {
1848 if (*flags & REF_BAD_NAME) {
1851 - oidclr(oid, the_repository->hash_algo);
1849 + oidclr(oid, refs->repo->hash_algo);
1850 *flags |= REF_ISBROKEN;
1851 }
1852 return refname;
@@ -1856,7 +1854,7 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
1854
1855 refname = sb_refname.buf;
1856 if (resolve_flags & RESOLVE_REF_NO_RECURSE) {
1859 - oidclr(oid, the_repository->hash_algo);
1857 + oidclr(oid, refs->repo->hash_algo);
1858 return refname;
1859 }
1860 if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) {
@@ -2011,7 +2009,7 @@ struct ref_store *repo_get_submodule_ref_store(struct repository *repo,
2009 free(subrepo);
2010 goto done;
2011 }
2014 - refs = ref_store_init(subrepo, the_repository->ref_storage_format,
2012 + refs = ref_store_init(subrepo, repo->ref_storage_format,
2013 submodule_sb.buf,
2014 REF_STORE_READ | REF_STORE_ODB);
2015 register_ref_store_map(&repo->submodule_ref_stores, "submodule",
@@ -2045,7 +2043,7 @@ struct ref_store *get_worktree_ref_store(const struct worktree *wt)
2043 common_path.buf, REF_STORE_ALL_CAPS);
2044 strbuf_release(&common_path);
2045 } else {
2048 - refs = ref_store_init(wt->repo, the_repository->ref_storage_format,
2046 + refs = ref_store_init(wt->repo, wt->repo->ref_storage_format,
2047 wt->repo->commondir, REF_STORE_ALL_CAPS);
2048 }
2049