summaryrefslogtreecommitdiff
path: root/object-file.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 /object-file.c
parentf1ce861c34bffbc02998173016b0bca0f6d9f6c4 (diff)
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 'object-file.c')
-rw-r--r--object-file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/object-file.c b/object-file.c
index dc9fcaf3e9..5d782417e3 100644
--- a/object-file.c
+++ b/object-file.c
@@ -388,7 +388,7 @@ int mkdir_in_gitdir(const char *path)
}
strbuf_release(&sb);
}
- return adjust_shared_perm(path);
+ return adjust_shared_perm(the_repository, path);
}
static enum scld_error safe_create_leading_directories_1(char *path, int share)
@@ -437,7 +437,7 @@ static enum scld_error safe_create_leading_directories_1(char *path, int share)
ret = SCLD_VANISHED;
else
ret = SCLD_FAILED;
- } else if (share && adjust_shared_perm(path)) {
+ } else if (share && adjust_shared_perm(the_repository, path)) {
ret = SCLD_PERMS;
}
*slash = slash_character;
@@ -2105,7 +2105,7 @@ retry:
}
out:
- if (adjust_shared_perm(filename))
+ if (adjust_shared_perm(the_repository, filename))
return error(_("unable to set permission to '%s'"), filename);
return 0;
}
@@ -2181,7 +2181,7 @@ static int create_tmpfile(struct strbuf *tmp, const char *filename)
strbuf_add(tmp, filename, dirlen - 1);
if (mkdir(tmp->buf, 0777) && errno != EEXIST)
return -1;
- if (adjust_shared_perm(tmp->buf))
+ if (adjust_shared_perm(the_repository, tmp->buf))
return -1;
/* Try again */