refs/files: introduce function to perform normal ref checks
In a subsequent commit we'll introduce new generic checks for direct refs. These checks will be independent of the actual backend. Introduce a new function `refs_fsck_ref()` that will be used for this purpose. At the current point in time it's still empty, but it will get populated in a subsequent commit. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Jan 12, 2026 at 10:02 UTC
ae38c3a359f4834d27f511f1fa9b982f5ad55c6a
3 files changed
+17
refs.c
+7
@@ -320,6 +320,13 @@ int check_refname_format(const char *refname, int flags)
320
return check_or_sanitize_refname(refname, flags, NULL);
321
}
322
323
+int refs_fsck_ref(struct ref_store *refs UNUSED, struct fsck_options *o UNUSED,
324
+ struct fsck_ref_report *report UNUSED,
325
+ const char *refname UNUSED, const struct object_id *oid UNUSED)
326
+{
327
+ return 0;
328
+}
329
+
330
int refs_fsck_symref(struct ref_store *refs UNUSED, struct fsck_options *o,
331
struct fsck_ref_report *report,
332
const char *refname UNUSED, const char *target)
refs.h
+8
@@ -655,6 +655,14 @@ int check_refname_format(const char *refname, int flags);
655
656
struct fsck_ref_report;
657
658
+/*
659
+ * Perform generic checks for a specific direct ref. This function is
660
+ * expected to be called by the ref backends for every symbolic ref.
661
+ */
662
+int refs_fsck_ref(struct ref_store *refs, struct fsck_options *o,
663
+ struct fsck_ref_report *report,
664
+ const char *refname, const struct object_id *oid);
665
+
666
/*
667
* Perform generic checks for a specific symref target. This function is
668
* expected to be called by the ref backends for every symbolic ref.
refs/files-backend.c
+2
@@ -3833,6 +3833,8 @@ static int files_fsck_refs_content(struct ref_store *ref_store,
3833
"has trailing garbage: '%s'", trailing);
3834
goto cleanup;
3835
}
3836
+
3837
+ ret = refs_fsck_ref(ref_store, o, &report, target_name, &oid);
3838
} else {
3839
ret = files_fsck_symref_target(ref_store, o, &report,
3840
target_name, &referent, 0);