aboutsummaryrefslogtreecommitdiff
path: root/pack-write.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 /pack-write.c
parentf1ce861c34bffbc02998173016b0bca0f6d9f6c4 (diff)
downloadgit-028f618658e34230e1d65678f14b6876e0f9856d.tar.xz
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 'pack-write.c')
-rw-r--r--pack-write.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/pack-write.c b/pack-write.c
index a2faeb1895..c3f4e66f02 100644
--- a/pack-write.c
+++ b/pack-write.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
#include "git-compat-util.h"
#include "environment.h"
#include "gettext.h"
@@ -287,7 +289,7 @@ char *write_rev_file_order(const struct git_hash_algo *hash_algo,
write_rev_index_positions(f, pack_order, nr_objects);
write_rev_trailer(hash_algo, f, hash);
- if (adjust_shared_perm(path) < 0)
+ if (adjust_shared_perm(the_repository, path) < 0)
die(_("failed to make %s readable"), path);
finalize_hashfile(f, NULL, FSYNC_COMPONENT_PACK_METADATA,
@@ -350,7 +352,7 @@ static char *write_mtimes_file(const struct git_hash_algo *hash_algo,
write_mtimes_objects(f, to_pack, objects, nr_objects);
write_mtimes_trailer(hash_algo, f, hash);
- if (adjust_shared_perm(mtimes_name) < 0)
+ if (adjust_shared_perm(the_repository, mtimes_name) < 0)
die(_("failed to make %s readable"), mtimes_name);
finalize_hashfile(f, NULL, FSYNC_COMPONENT_PACK_METADATA,
@@ -565,12 +567,12 @@ void stage_tmp_packfiles(const struct git_hash_algo *hash_algo,
char *rev_tmp_name = NULL;
char *mtimes_tmp_name = NULL;
- if (adjust_shared_perm(pack_tmp_name))
+ if (adjust_shared_perm(the_repository, pack_tmp_name))
die_errno("unable to make temporary pack file readable");
*idx_tmp_name = (char *)write_idx_file(hash_algo, NULL, written_list,
nr_written, pack_idx_opts, hash);
- if (adjust_shared_perm(*idx_tmp_name))
+ if (adjust_shared_perm(the_repository, *idx_tmp_name))
die_errno("unable to make temporary index file readable");
rev_tmp_name = write_rev_file(hash_algo, NULL, written_list, nr_written,