Skip to content

Commit 1cd772c

Browse files
dschogitster
authored andcommitted
fsck: give the error function a chance to see the fsck_options
We will need this in the next commit, where fsck will be taught to optionally name the objects when reporting issues about them. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7b35efd commit 1cd772c

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

builtin/fsck.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ static int objerror(struct object *obj, const char *err)
8282
return -1;
8383
}
8484

85-
static int fsck_error_func(struct object *obj, int type, const char *message)
85+
static int fsck_error_func(struct fsck_options *o,
86+
struct object *obj, int type, const char *message)
8687
{
8788
objreport(obj, (type == FSCK_WARN) ? "warning" : "error", message);
8889
return (type == FSCK_WARN) ? 0 : 1;

fsck.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static int report(struct fsck_options *options, struct object *object,
291291

292292
va_start(ap, fmt);
293293
strbuf_vaddf(&sb, fmt, ap);
294-
result = options->error_func(object, msg_type, sb.buf);
294+
result = options->error_func(options, object, msg_type, sb.buf);
295295
strbuf_release(&sb);
296296
va_end(ap);
297297

@@ -897,7 +897,8 @@ int fsck_object(struct object *obj, void *data, unsigned long size,
897897
obj->type);
898898
}
899899

900-
int fsck_error_function(struct object *obj, int msg_type, const char *message)
900+
int fsck_error_function(struct fsck_options *o,
901+
struct object *obj, int msg_type, const char *message)
901902
{
902903
if (msg_type == FSCK_WARN) {
903904
warning("object %s: %s", oid_to_hex(&obj->oid), message);

fsck.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ int is_valid_msg_type(const char *msg_id, const char *msg_type);
2323
typedef int (*fsck_walk_func)(struct object *obj, int type, void *data, struct fsck_options *options);
2424

2525
/* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
26-
typedef int (*fsck_error)(struct object *obj, int type, const char *message);
26+
typedef int (*fsck_error)(struct fsck_options *o,
27+
struct object *obj, int type, const char *message);
2728

28-
int fsck_error_function(struct object *obj, int type, const char *message);
29+
int fsck_error_function(struct fsck_options *o,
30+
struct object *obj, int type, const char *message);
2931

3032
struct fsck_options {
3133
fsck_walk_func walk;

0 commit comments

Comments
 (0)