Skip to content

Commit 8cd4a44

Browse files
shejialuogitster
authored andcommitted
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 <[email protected]> Mentored-by: Karthik Nayak <[email protected]> Signed-off-by: shejialuo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2d79aa9 commit 8cd4a44

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

builtin/fsck.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ static int objerror(struct object *obj, const char *err)
8989
return -1;
9090
}
9191

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)
9898
{
9999
switch (msg_type) {
100100
case FSCK_WARN:
@@ -938,7 +938,7 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
938938

939939
fsck_walk_options.walk = mark_object;
940940
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;
942942
if (check_strict)
943943
fsck_obj_options.strict = 1;
944944

fsck.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ int fsck_buffer(const struct object_id *oid, enum object_type type,
12001200
type);
12011201
}
12021202

1203-
int fsck_error_function(struct fsck_options *o,
1203+
int fsck_objects_error_function(struct fsck_options *o,
12041204
const struct object_id *oid,
12051205
enum object_type object_type UNUSED,
12061206
enum fsck_msg_type msg_type,
@@ -1303,16 +1303,17 @@ int git_fsck_config(const char *var, const char *value,
13031303
* Custom error callbacks that are used in more than one place.
13041304
*/
13051305

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)
13121312
{
13131313
if (msg_id == FSCK_MSG_GITMODULES_MISSING) {
13141314
puts(oid_to_hex(oid));
13151315
return 0;
13161316
}
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);
13181319
}

fsck.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ typedef int (*fsck_error)(struct fsck_options *o,
120120
enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
121121
const char *message);
122122

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);
133133

134134
struct fsck_options {
135135
fsck_walk_func walk;
@@ -150,23 +150,23 @@ struct fsck_options {
150150
.gitmodules_done = OIDSET_INIT, \
151151
.gitattributes_found = OIDSET_INIT, \
152152
.gitattributes_done = OIDSET_INIT, \
153-
.error_func = fsck_error_function \
153+
.error_func = fsck_objects_error_function \
154154
}
155155
#define FSCK_OPTIONS_STRICT { \
156156
.strict = 1, \
157157
.gitmodules_found = OIDSET_INIT, \
158158
.gitmodules_done = OIDSET_INIT, \
159159
.gitattributes_found = OIDSET_INIT, \
160160
.gitattributes_done = OIDSET_INIT, \
161-
.error_func = fsck_error_function, \
161+
.error_func = fsck_objects_error_function, \
162162
}
163163
#define FSCK_OPTIONS_MISSING_GITMODULES { \
164164
.strict = 1, \
165165
.gitmodules_found = OIDSET_INIT, \
166166
.gitmodules_done = OIDSET_INIT, \
167167
.gitattributes_found = OIDSET_INIT, \
168168
.gitattributes_done = OIDSET_INIT, \
169-
.error_func = fsck_error_cb_print_missing_gitmodules, \
169+
.error_func = fsck_objects_error_cb_print_missing_gitmodules, \
170170
}
171171

172172
/* descend in all linked child objects

0 commit comments

Comments
 (0)