aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
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 /builtin
parent228457c9d9f32f000f5c04c36fcce9002f72965a (diff)
downloadgit-74d414c9f14a91a3b7bd04972bf3eb9bbe6fd81b.tar.gz
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 'builtin')
-rw-r--r--builtin/fsck.c4
-rw-r--r--builtin/grep.c2
-rw-r--r--builtin/index-pack.c4
-rw-r--r--builtin/log.c2
-rw-r--r--builtin/name-rev.c4
-rw-r--r--builtin/pack-objects.c2
-rw-r--r--builtin/prune.c2
7 files changed, 10 insertions, 10 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index eea1d43647..62c7494bbd 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -399,12 +399,12 @@ static void check_connectivity(void)
}
/* Look up all the requirements, warn about missing objects.. */
- max = get_max_object_index();
+ max = get_max_object_index(the_repository);
if (verbose)
fprintf_ln(stderr, _("Checking connectivity (%d objects)"), max);
for (i = 0; i < max; i++) {
- struct object *obj = get_indexed_object(i);
+ struct object *obj = get_indexed_object(the_repository, i);
if (obj)
check_object(obj);
diff --git a/builtin/grep.c b/builtin/grep.c
index d1427290f7..cbbf6f2643 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1144,7 +1144,7 @@ int cmd_grep(int argc,
break;
}
- object = parse_object_or_die(&oid, arg);
+ object = parse_object_or_die(the_repository, &oid, arg);
if (!seen_dashdash)
verify_non_filename(prefix, arg);
add_object_array_with_path(object, arg, &list, oc.mode, oc.path);
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 3eb5af2095..1268032d76 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -279,14 +279,14 @@ static unsigned check_objects(void)
{
unsigned i, max, foreign_nr = 0;
- max = get_max_object_index();
+ max = get_max_object_index(the_repository);
if (verbose)
progress = start_delayed_progress(the_repository,
_("Checking objects"), max);
for (i = 0; i < max; i++) {
- foreign_nr += check_object(get_indexed_object(i));
+ foreign_nr += check_object(get_indexed_object(the_repository, i));
display_progress(progress, i + 1);
}
diff --git a/builtin/log.c b/builtin/log.c
index 04a6ef97bc..0d4c579dad 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -2468,7 +2468,7 @@ int cmd_format_patch(int argc,
base = get_base_commit(&cfg, list, nr);
if (base) {
reset_revision_walk();
- clear_object_flags(UNINTERESTING);
+ clear_object_flags(the_repository, UNINTERESTING);
prepare_bases(&bases, base, list, nr);
}
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index beac166b5c..2fe82c839b 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -667,9 +667,9 @@ int cmd_name_rev(int argc,
} else if (all) {
int i, max;
- max = get_max_object_index();
+ max = get_max_object_index(the_repository);
for (i = 0; i < max; i++) {
- struct object *obj = get_indexed_object(i);
+ struct object *obj = get_indexed_object(the_repository, i);
if (!obj || obj->type != OBJ_COMMIT)
continue;
show_name(obj, NULL,
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 8e282f2a98..c3adbc9450 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -4161,7 +4161,7 @@ static int mark_bitmap_preferred_tip(const char *refname,
if (!peel_iterated_oid(the_repository, oid, &peeled))
oid = &peeled;
- object = parse_object_or_die(oid, refname);
+ object = parse_object_or_die(the_repository, oid, refname);
if (object->type == OBJ_COMMIT)
object->flags |= NEEDS_BITMAP;
diff --git a/builtin/prune.c b/builtin/prune.c
index 1c357fffd8..8f52da8bd6 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -185,7 +185,7 @@ int cmd_prune(int argc,
const char *name = *argv++;
if (!repo_get_oid(the_repository, name, &oid)) {
- struct object *object = parse_object_or_die(&oid,
+ struct object *object = parse_object_or_die(the_repository, &oid,
name);
add_pending_object(&revs, object, "");
}