]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsck: rename objects-related fsck error functions
authorshejialuo <shejialuo@gmail.com>
Thu, 8 Aug 2024 11:24:25 +0000 (19:24 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Aug 2024 16:36:52 +0000 (09:36 -0700)
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>
builtin/fsck.c
fsck.c
fsck.h

index d13a226c2ed86bf87e3d637060e2940f69ac602e..6d86bbe1e98e48124147f0a22167f2013e9512f6 100644 (file)
@@ -89,12 +89,12 @@ static int objerror(struct object *obj, const char *err)
        return -1;
 }
 
-static int fsck_error_func(struct fsck_options *o UNUSED,
-                          const struct object_id *oid,
-                          enum object_type object_type,
-                          enum fsck_msg_type msg_type,
-                          enum fsck_msg_id msg_id UNUSED,
-                          const char *message)
+static int fsck_objects_error_func(struct fsck_options *o UNUSED,
+                                  const struct object_id *oid,
+                                  enum object_type object_type,
+                                  enum fsck_msg_type msg_type,
+                                  enum fsck_msg_id msg_id UNUSED,
+                                  const char *message)
 {
        switch (msg_type) {
        case FSCK_WARN:
@@ -938,7 +938,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
 
        fsck_walk_options.walk = mark_object;
        fsck_obj_options.walk = mark_used;
-       fsck_obj_options.error_func = fsck_error_func;
+       fsck_obj_options.error_func = fsck_objects_error_func;
        if (check_strict)
                fsck_obj_options.strict = 1;
 
diff --git a/fsck.c b/fsck.c
index 3f324414924d087ef78ce9bc3d697c29a46641cf..8347842cfb2c5915b22b99f4a66033602f0bee4e 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -1200,7 +1200,7 @@ int fsck_buffer(const struct object_id *oid, enum object_type type,
                      type);
 }
 
-int fsck_error_function(struct fsck_options *o,
+int fsck_objects_error_function(struct fsck_options *o,
                        const struct object_id *oid,
                        enum object_type object_type UNUSED,
                        enum fsck_msg_type msg_type,
@@ -1303,16 +1303,17 @@ int git_fsck_config(const char *var, const char *value,
  * Custom error callbacks that are used in more than one place.
  */
 
-int fsck_error_cb_print_missing_gitmodules(struct fsck_options *o,
-                                          const struct object_id *oid,
-                                          enum object_type object_type,
-                                          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,
+                                                  enum fsck_msg_type msg_type,
+                                                  enum fsck_msg_id msg_id,
+                                                  const char *message)
 {
        if (msg_id == FSCK_MSG_GITMODULES_MISSING) {
                puts(oid_to_hex(oid));
                return 0;
        }
-       return fsck_error_function(o, oid, object_type, msg_type, msg_id, message);
+       return fsck_objects_error_function(o, oid, object_type,
+                                          msg_type, msg_id, message);
 }
diff --git a/fsck.h b/fsck.h
index bcfb2e34cd6d1dbb3f777a5873f1a25dd0bd00f4..41ebebbb5949b65e2b26cf7de4eaf61209fe4ae3 100644 (file)
--- a/fsck.h
+++ b/fsck.h
@@ -120,16 +120,16 @@ typedef int (*fsck_error)(struct fsck_options *o,
                          enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
                          const char *message);
 
-int fsck_error_function(struct fsck_options *o,
-                       const struct object_id *oid, enum object_type object_type,
-                       enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
-                       const char *message);
-int fsck_error_cb_print_missing_gitmodules(struct fsck_options *o,
-                                          const struct object_id *oid,
-                                          enum object_type object_type,
-                                          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,
+                               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,
+                                                  enum fsck_msg_type msg_type,
+                                                  enum fsck_msg_id msg_id,
+                                                  const char *message);
 
 struct fsck_options {
        fsck_walk_func walk;
@@ -150,7 +150,7 @@ struct fsck_options {
        .gitmodules_done = OIDSET_INIT, \
        .gitattributes_found = OIDSET_INIT, \
        .gitattributes_done = OIDSET_INIT, \
-       .error_func = fsck_error_function \
+       .error_func = fsck_objects_error_function \
 }
 #define FSCK_OPTIONS_STRICT { \
        .strict = 1, \
@@ -158,7 +158,7 @@ struct fsck_options {
        .gitmodules_done = OIDSET_INIT, \
        .gitattributes_found = OIDSET_INIT, \
        .gitattributes_done = OIDSET_INIT, \
-       .error_func = fsck_error_function, \
+       .error_func = fsck_objects_error_function, \
 }
 #define FSCK_OPTIONS_MISSING_GITMODULES { \
        .strict = 1, \
@@ -166,7 +166,7 @@ struct fsck_options {
        .gitmodules_done = OIDSET_INIT, \
        .gitattributes_found = OIDSET_INIT, \
        .gitattributes_done = OIDSET_INIT, \
-       .error_func = fsck_error_cb_print_missing_gitmodules, \
+       .error_func = fsck_objects_error_cb_print_missing_gitmodules, \
 }
 
 /* descend in all linked child objects