fsck: rename objects-related fsck error functions

The names of objects-related fsck error functions are generic. It's OK when there is only object database check. However, we are going to introduce refs database check report function. To avoid ambiguity, rename object-related fsck error functions to explicitly indicate these functions are used to report objects-related messages. 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>

shejialuo committed Aug 8, 2024 at 19:24 UTC 8cd4a447b8b022a25e05653eb5f2dd80b9009bbe
3 files changed +29 -28
builtin/fsck.c
+7 -7
@@ -89,12 +89,12 @@ static int objerror(struct object *obj, const char *err)
89 return -1;
90 }
91
92 -static int fsck_error_func(struct fsck_options *o UNUSED,
93 - const struct object_id *oid,
94 - enum object_type object_type,
95 - enum fsck_msg_type msg_type,
96 - enum fsck_msg_id msg_id UNUSED,
97 - const char *message)
92 +static int fsck_objects_error_func(struct fsck_options *o UNUSED,
93 + const struct object_id *oid,
94 + enum object_type object_type,
95 + enum fsck_msg_type msg_type,
96 + enum fsck_msg_id msg_id UNUSED,
97 + const char *message)
98 {
99 switch (msg_type) {
100 case FSCK_WARN:
@@ -938,7 +938,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
938
939 fsck_walk_options.walk = mark_object;
940 fsck_obj_options.walk = mark_used;
941 - fsck_obj_options.error_func = fsck_error_func;
941 + fsck_obj_options.error_func = fsck_objects_error_func;
942 if (check_strict)
943 fsck_obj_options.strict = 1;
944
fsck.c
+9 -8
@@ -1200,7 +1200,7 @@ int fsck_buffer(const struct object_id *oid, enum object_type type,
1200 type);
1201 }
1202
1203 -int fsck_error_function(struct fsck_options *o,
1203 +int fsck_objects_error_function(struct fsck_options *o,
1204 const struct object_id *oid,
1205 enum object_type object_type UNUSED,
1206 enum fsck_msg_type msg_type,
@@ -1303,16 +1303,17 @@ int git_fsck_config(const char *var, const char *value,
1303 * Custom error callbacks that are used in more than one place.
1304 */
1305
1306 -int fsck_error_cb_print_missing_gitmodules(struct fsck_options *o,
1307 - const struct object_id *oid,
1308 - enum object_type object_type,
1309 - enum fsck_msg_type msg_type,
1310 - enum fsck_msg_id msg_id,
1311 - const char *message)
1306 +int fsck_objects_error_cb_print_missing_gitmodules(struct fsck_options *o,
1307 + const struct object_id *oid,
1308 + enum object_type object_type,
1309 + enum fsck_msg_type msg_type,
1310 + enum fsck_msg_id msg_id,
1311 + const char *message)
1312 {
1313 if (msg_id == FSCK_MSG_GITMODULES_MISSING) {
1314 puts(oid_to_hex(oid));
1315 return 0;
1316 }
1317 - return fsck_error_function(o, oid, object_type, msg_type, msg_id, message);
1317 + return fsck_objects_error_function(o, oid, object_type,
1318 + msg_type, msg_id, message);
1319 }
fsck.h
+13 -13
@@ -120,16 +120,16 @@ typedef int (*fsck_error)(struct fsck_options *o,
120 enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
121 const char *message);
122
123 -int fsck_error_function(struct fsck_options *o,
124 - const struct object_id *oid, enum object_type object_type,
125 - enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
126 - const char *message);
127 -int fsck_error_cb_print_missing_gitmodules(struct fsck_options *o,
128 - const struct object_id *oid,
129 - enum object_type object_type,
130 - enum fsck_msg_type msg_type,
131 - enum fsck_msg_id msg_id,
132 - const char *message);
123 +int fsck_objects_error_function(struct fsck_options *o,
124 + const struct object_id *oid, enum object_type object_type,
125 + enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
126 + const char *message);
127 +int fsck_objects_error_cb_print_missing_gitmodules(struct fsck_options *o,
128 + const struct object_id *oid,
129 + enum object_type object_type,
130 + enum fsck_msg_type msg_type,
131 + enum fsck_msg_id msg_id,
132 + const char *message);
133
134 struct fsck_options {
135 fsck_walk_func walk;
@@ -150,7 +150,7 @@ struct fsck_options {
150 .gitmodules_done = OIDSET_INIT, \
151 .gitattributes_found = OIDSET_INIT, \
152 .gitattributes_done = OIDSET_INIT, \
153 - .error_func = fsck_error_function \
153 + .error_func = fsck_objects_error_function \
154 }
155 #define FSCK_OPTIONS_STRICT { \
156 .strict = 1, \
@@ -158,7 +158,7 @@ struct fsck_options {
158 .gitmodules_done = OIDSET_INIT, \
159 .gitattributes_found = OIDSET_INIT, \
160 .gitattributes_done = OIDSET_INIT, \
161 - .error_func = fsck_error_function, \
161 + .error_func = fsck_objects_error_function, \
162 }
163 #define FSCK_OPTIONS_MISSING_GITMODULES { \
164 .strict = 1, \
@@ -166,7 +166,7 @@ struct fsck_options {
166 .gitmodules_done = OIDSET_INIT, \
167 .gitattributes_found = OIDSET_INIT, \
168 .gitattributes_done = OIDSET_INIT, \
169 - .error_func = fsck_error_cb_print_missing_gitmodules, \
169 + .error_func = fsck_objects_error_cb_print_missing_gitmodules, \
170 }
171
172 /* descend in all linked child objects