aboutsummaryrefslogtreecommitdiffstats
path: root/upload-pack.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-03-10 08:13:21 +0100
committerJunio C Hamano <gitster@pobox.com>2025-03-10 13:16:18 -0700
commit74d414c9f14a91a3b7bd04972bf3eb9bbe6fd81b (patch)
tree7a267ede2a7630503346248db75be00cfd828f00 /upload-pack.c
parentcsum-file: stop depending on `the_repository` (diff)
downloadgit-74d414c9f14a91a3b7bd04972bf3eb9bbe6fd81b.tar.gz
git-74d414c9f14a91a3b7bd04972bf3eb9bbe6fd81b.zip
object: stop depending on `the_repository`
There are a couple of functions exposed by "object.c" that implicitly depend on `the_repository`. Remove this dependency by injecting the repository via a parameter. Adapt callers accordingly by simply using `the_repository`, except in cases where the subsystem is already free of the repository. In that case, we instead pass the repository provided by the caller's context. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 7498b45e2e..67063708b8 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -665,8 +665,8 @@ static int do_reachable_revlist(struct child_process *cmd,
cmd_in = xfdopen(cmd->in, "w");
- for (i = get_max_object_index(); 0 < i; ) {
- o = get_indexed_object(--i);
+ for (i = get_max_object_index(the_repository); 0 < i; ) {
+ o = get_indexed_object(the_repository, --i);
if (!o)
continue;
if (reachable && o->type == OBJ_COMMIT)
@@ -734,8 +734,8 @@ static int get_reachable_list(struct upload_pack_data *data,
o->flags &= ~TMP_MARK;
}
}
- for (i = get_max_object_index(); 0 < i; i--) {
- o = get_indexed_object(i - 1);
+ for (i = get_max_object_index(the_repository); 0 < i; i--) {
+ o = get_indexed_object(the_repository, i - 1);
if (o && o->type == OBJ_COMMIT &&
(o->flags & TMP_MARK)) {
add_object_array(o, NULL, reachable);
@@ -1557,7 +1557,7 @@ static int parse_want_ref(struct packet_writer *writer, const char *line,
}
if (!o)
- o = parse_object_or_die(&oid, refname_nons);
+ o = parse_object_or_die(the_repository, &oid, refname_nons);
if (!(o->flags & WANTED)) {
o->flags |= WANTED;
@@ -1793,7 +1793,7 @@ int upload_pack_v2(struct repository *r, struct packet_reader *request)
enum fetch_state state = FETCH_PROCESS_ARGS;
struct upload_pack_data data;
- clear_object_flags(ALL_FLAGS);
+ clear_object_flags(the_repository, ALL_FLAGS);
upload_pack_data_init(&data);
data.use_sideband = LARGE_PACKET_MAX;