aboutsummaryrefslogtreecommitdiff
path: root/fsck.h
diff options
context:
space:
mode:
Diffstat (limited to 'fsck.h')
-rw-r--r--fsck.h53
1 files changed, 23 insertions, 30 deletions
diff --git a/fsck.h b/fsck.h
index cb6ef32f4f..e77935c8a9 100644
--- a/fsck.h
+++ b/fsck.h
@@ -30,6 +30,7 @@ enum fsck_msg_type {
FUNC(BAD_DATE_OVERFLOW, ERROR) \
FUNC(BAD_EMAIL, ERROR) \
FUNC(BAD_GPGSIG, ERROR) \
+ FUNC(BAD_HEAD_TARGET, ERROR) \
FUNC(BAD_NAME, ERROR) \
FUNC(BAD_OBJECT_SHA1, ERROR) \
FUNC(BAD_PACKED_REF_ENTRY, ERROR) \
@@ -39,6 +40,7 @@ enum fsck_msg_type {
FUNC(BAD_REF_CONTENT, ERROR) \
FUNC(BAD_REF_FILETYPE, ERROR) \
FUNC(BAD_REF_NAME, ERROR) \
+ FUNC(BAD_REF_OID, ERROR) \
FUNC(BAD_TIMEZONE, ERROR) \
FUNC(BAD_TREE, ERROR) \
FUNC(BAD_TREE_SHA1, ERROR) \
@@ -162,11 +164,12 @@ struct fsck_object_report {
struct fsck_ref_report {
const char *path;
- const struct object_id *oid;
- const char *referent;
};
+struct repository;
+
struct fsck_options {
+ struct repository *repo;
fsck_walk_func walk;
fsck_error error_func;
unsigned strict;
@@ -180,34 +183,6 @@ struct fsck_options {
kh_oid_map_t *object_names;
};
-#define FSCK_OPTIONS_DEFAULT { \
- .skip_oids = OIDSET_INIT, \
- .gitmodules_found = OIDSET_INIT, \
- .gitmodules_done = OIDSET_INIT, \
- .gitattributes_found = OIDSET_INIT, \
- .gitattributes_done = OIDSET_INIT, \
- .error_func = fsck_objects_error_function \
-}
-#define FSCK_OPTIONS_STRICT { \
- .strict = 1, \
- .gitmodules_found = OIDSET_INIT, \
- .gitmodules_done = OIDSET_INIT, \
- .gitattributes_found = OIDSET_INIT, \
- .gitattributes_done = OIDSET_INIT, \
- .error_func = fsck_objects_error_function, \
-}
-#define FSCK_OPTIONS_MISSING_GITMODULES { \
- .strict = 1, \
- .gitmodules_found = OIDSET_INIT, \
- .gitmodules_done = OIDSET_INIT, \
- .gitattributes_found = OIDSET_INIT, \
- .gitattributes_done = OIDSET_INIT, \
- .error_func = fsck_objects_error_cb_print_missing_gitmodules, \
-}
-#define FSCK_REFS_OPTIONS_DEFAULT { \
- .error_func = fsck_refs_error_function, \
-}
-
/* descend in all linked child objects
* the return value is:
* -1 error in processing the object
@@ -249,6 +224,24 @@ int fsck_tag_standalone(const struct object_id *oid, const char *buffer,
int fsck_finish(struct fsck_options *options);
/*
+ * Check whether there are any checks that have been queued up and that still
+ * need to be run. Returns `false` iff `fsck_finish()` wouldn't perform any
+ * actions, `true` otherwise.
+ */
+bool fsck_has_queued_checks(struct fsck_options *options);
+
+enum fsck_options_type {
+ FSCK_OPTIONS_DEFAULT,
+ FSCK_OPTIONS_STRICT,
+ FSCK_OPTIONS_MISSING_GITMODULES,
+ FSCK_OPTIONS_REFS,
+};
+
+void fsck_options_init(struct fsck_options *options,
+ struct repository *repo,
+ enum fsck_options_type type);
+
+/*
* Clear the fsck_options struct, freeing any allocated memory.
*/
void fsck_options_clear(struct fsck_options *options);