]> git.ipfire.org Git - thirdparty/git.git/commitdiff
refs/files: move fsck functions into global scope
authorPatrick Steinhardt <ps@pks.im>
Mon, 12 Jan 2026 09:02:51 +0000 (10:02 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Jan 2026 14:55:40 +0000 (06:55 -0800)
When performing consistency checks we pass the functions that perform
the verification down the calling stack. This is somewhat unnecessary
though, as the set of functions doesn't ever change.

Simplify the code by moving the array into global scope and remove the
parameter.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c

index 297739f203d74e18f5e11517dd484490e6da6918..feba3ee58bcc9b7e822ab5d0d009345e3e7e5936 100644 (file)
@@ -3890,11 +3890,16 @@ cleanup:
        return ret;
 }
 
+static const files_fsck_refs_fn fsck_refs_fn[]= {
+       files_fsck_refs_name,
+       files_fsck_refs_content,
+       NULL,
+};
+
 static int files_fsck_refs_dir(struct ref_store *ref_store,
                               struct fsck_options *o,
                               const char *refs_check_dir,
-                              struct worktree *wt,
-                              files_fsck_refs_fn *fsck_refs_fn)
+                              struct worktree *wt)
 {
        struct strbuf refname = STRBUF_INIT;
        struct strbuf sb = STRBUF_INIT;
@@ -3955,13 +3960,7 @@ static int files_fsck_refs(struct ref_store *ref_store,
                           struct fsck_options *o,
                           struct worktree *wt)
 {
-       files_fsck_refs_fn fsck_refs_fn[]= {
-               files_fsck_refs_name,
-               files_fsck_refs_content,
-               NULL,
-       };
-
-       return files_fsck_refs_dir(ref_store, o, "refs", wt, fsck_refs_fn);
+       return files_fsck_refs_dir(ref_store, o, "refs", wt);
 }
 
 static int files_fsck(struct ref_store *ref_store,