aboutsummaryrefslogtreecommitdiff
path: root/object-file.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-03-23 16:02:53 +0100
committerJunio C Hamano <gitster@pobox.com>2026-03-23 08:33:10 -0700
commitf22360902621e0807a1c0a77476e3e4d323c708d (patch)
treead15abf7edc06866b913901a3de9aee6b31218a3 /object-file.c
parent17cabd369b5cb96bee9577f49247ef95d07058a7 (diff)
downloadgit-f22360902621e0807a1c0a77476e3e4d323c708d.tar.xz
fsck: initialize fsck options via a function
We initialize the `struct fsck_options` via a set of macros, often in global scope. In the next commit though we're about to introduce a new repository field to the options that must be initialized, and naturally we don't have a repo other than `the_repository` available in this scope. Refactor the code to instead intrdouce a new `fsck_options_init()` function that initializes the options for us and move initialization into function scope. 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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/object-file.c b/object-file.c
index c62e5496e0..186b2ff764 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1279,8 +1279,9 @@ static int index_mem(struct index_state *istate,
}
}
if (flags & INDEX_FORMAT_CHECK) {
- struct fsck_options opts = FSCK_OPTIONS_DEFAULT;
+ struct fsck_options opts;
+ fsck_options_init(&opts, FSCK_OPTIONS_DEFAULT);
opts.strict = 1;
opts.error_func = hash_format_check_report;
if (fsck_buffer(null_oid(istate->repo->hash_algo), type, buf, size, &opts))