From f22360902621e0807a1c0a77476e3e4d323c708d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 23 Mar 2026 16:02:53 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- object-file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'object-file.c') 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)) -- cgit v1.3-6-g1900