aboutsummaryrefslogtreecommitdiffstats
path: root/refs/files-backend.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-02-07 12:03:41 +0100
committerJunio C Hamano <gitster@pobox.com>2025-02-28 13:54:11 -0800
commit028f618658e34230e1d65678f14b6876e0f9856d (patch)
tree696b719e0dc2e67551193239522fbfb7113d1516 /refs/files-backend.c
parentenvironment: move access to "core.sharedRepository" into repo settings (diff)
downloadgit-028f618658e34230e1d65678f14b6876e0f9856d.tar.gz
git-028f618658e34230e1d65678f14b6876e0f9856d.zip
path: adjust last remaining users of `the_repository`
With the preceding refactorings we now only have a couple of implicit users of `the_repository` left in the "path" subsystem, all of which depend on global state via `calc_shared_perm()`. Make the dependency on `the_repository` explicit by passing the repo as a parameter instead and adjust callers accordingly. Note that this change bubbles up into a couple of subsystems that were previously declared as free from `the_repository`. Instead of marking all of them as `the_repository`-dependent again, we instead use the repository that is available in the calling context. There are three exceptions though with "copy.c", "pack-write.c" and "tempfile.c". Adjusting these would require us to adapt callsites all over the place, so this is left for a future iteration. Mark "path.c" as free from `the_repository`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs/files-backend.c')
-rw-r--r--refs/files-backend.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 29f08dced4..6c6e67dc1c 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1831,7 +1831,7 @@ static int log_ref_setup(struct files_ref_store *refs,
}
if (*logfd >= 0)
- adjust_shared_perm(logfile);
+ adjust_shared_perm(the_repository, logfile);
free(logfile);
return 0;
@@ -3488,8 +3488,8 @@ static int files_ref_store_create_on_disk(struct ref_store *ref_store,
* they do not understand the reference format extension.
*/
strbuf_addf(&sb, "%s/refs", ref_store->gitdir);
- safe_create_dir(sb.buf, 1);
- adjust_shared_perm(sb.buf);
+ safe_create_dir(the_repository, sb.buf, 1);
+ adjust_shared_perm(the_repository, sb.buf);
/*
* There is no need to create directories for common refs when creating
@@ -3501,11 +3501,11 @@ static int files_ref_store_create_on_disk(struct ref_store *ref_store,
*/
strbuf_reset(&sb);
files_ref_path(refs, &sb, "refs/heads");
- safe_create_dir(sb.buf, 1);
+ safe_create_dir(the_repository, sb.buf, 1);
strbuf_reset(&sb);
files_ref_path(refs, &sb, "refs/tags");
- safe_create_dir(sb.buf, 1);
+ safe_create_dir(the_repository, sb.buf, 1);
}
strbuf_release(&sb);