aboutsummaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-23 16:02:54 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-23 08:33:10 -0700
commit374985390871cb67c02b1608b693480e89567b9a (patch)
treee8738aebd1a1192a4c9862f6eebeb816c6f28296 /builtin/fsck.c
parentf22360902621e0807a1c0a77476e3e4d323c708d (diff)
downloadgit-374985390871cb67c02b1608b693480e89567b9a.tar.xz
fsck: store repository in fsck options
The fsck subsystem relies on `the_repository` quite a bit. While we could of course explicitly pass a repository down the callchain, we already have a `struct fsck_options` that we pass to almost all functions. Extend the options to also store the repository to make it readily available. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 59e3b0f7ac..990d836918 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -243,7 +243,7 @@ static int mark_unreachable_referents(const struct object_id *oid,
object_as_type(obj, type, 0);
}
- fsck_options_init(&options, FSCK_OPTIONS_DEFAULT);
+ fsck_options_init(&options, the_repository, FSCK_OPTIONS_DEFAULT);
options.walk = mark_used;
fsck_walk(obj, NULL, &options);
if (obj->type == OBJ_TREE)
@@ -987,7 +987,7 @@ static struct option fsck_opts[] = {
int cmd_fsck(int argc,
const char **argv,
const char *prefix,
- struct repository *repo UNUSED)
+ struct repository *repo)
{
struct odb_source *source;
struct snapshot snap = {
@@ -1005,10 +1005,10 @@ int cmd_fsck(int argc,
argc = parse_options(argc, argv, prefix, fsck_opts, fsck_usage, 0);
- fsck_options_init(&fsck_walk_options, FSCK_OPTIONS_DEFAULT);
+ fsck_options_init(&fsck_walk_options, repo, FSCK_OPTIONS_DEFAULT);
fsck_walk_options.walk = mark_object;
- fsck_options_init(&fsck_obj_options, FSCK_OPTIONS_DEFAULT);
+ fsck_options_init(&fsck_obj_options, repo, FSCK_OPTIONS_DEFAULT);
fsck_obj_options.walk = mark_used;
fsck_obj_options.error_func = fsck_objects_error_func;
if (check_strict)