mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
fsck: make "fsck_error" callback generic
The "fsck_error" callback is designed to report the objects-related error messages. It accepts two parameter "oid" and "object_type" which is not generic. In order to provide a unified callback which can report either objects or refs, remove the objects-related parameters and add the generic parameter "void *fsck_report". Create a new "fsck_object_report" structure which incorporates the removed parameters "oid" and "object_type". Then change the corresponding references to adapt to new "fsck_error" callback. Mentored-by: Patrick Steinhardt <ps@pks.im> Mentored-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: shejialuo <shejialuo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
8cd4a447b8
commit
0ec5dfe8c4
17
fsck.h
17
fsck.h
@@ -114,23 +114,30 @@ int is_valid_msg_type(const char *msg_id, const char *msg_type);
|
||||
typedef int (*fsck_walk_func)(struct object *obj, enum object_type object_type,
|
||||
void *data, struct fsck_options *options);
|
||||
|
||||
/* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
|
||||
/*
|
||||
* Callback for reporting errors either for objects or refs. The "fsck_report"
|
||||
* is a generic pointer that can be used to pass any information.
|
||||
*/
|
||||
typedef int (*fsck_error)(struct fsck_options *o,
|
||||
const struct object_id *oid, enum object_type object_type,
|
||||
void *fsck_report,
|
||||
enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
|
||||
const char *message);
|
||||
|
||||
int fsck_objects_error_function(struct fsck_options *o,
|
||||
const struct object_id *oid, enum object_type object_type,
|
||||
void *fsck_report,
|
||||
enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
|
||||
const char *message);
|
||||
int fsck_objects_error_cb_print_missing_gitmodules(struct fsck_options *o,
|
||||
const struct object_id *oid,
|
||||
enum object_type object_type,
|
||||
void *fsck_report,
|
||||
enum fsck_msg_type msg_type,
|
||||
enum fsck_msg_id msg_id,
|
||||
const char *message);
|
||||
|
||||
struct fsck_object_report {
|
||||
const struct object_id *oid;
|
||||
enum object_type object_type;
|
||||
};
|
||||
|
||||
struct fsck_options {
|
||||
fsck_walk_func walk;
|
||||
fsck_error error_func;
|
||||
|
||||
Reference in New Issue
Block a user