fsck: only provide oid/type in fsck_error callback
None of the callbacks actually care about having a "struct object"; they're happy with just the oid and type information. So let's give ourselves more flexibility to avoid having a "struct object" by just passing the broken-down fields. Note that the callback already takes a "type" field for the fsck message type. We'll rename that to "msg_type" (and use "object_type" for the object type) to make the distinction explicit. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
82ef89b318
commit
5afc4b1dc6
@ -104,23 +104,26 @@ static int objerror(struct object *obj, const char *err)
|
||||
}
|
||||
|
||||
static int fsck_error_func(struct fsck_options *o,
|
||||
struct object *obj, int type, const char *message)
|
||||
const struct object_id *oid,
|
||||
enum object_type object_type,
|
||||
int msg_type, const char *message)
|
||||
{
|
||||
switch (type) {
|
||||
switch (msg_type) {
|
||||
case FSCK_WARN:
|
||||
/* TRANSLATORS: e.g. warning in tree 01bfda: <more explanation> */
|
||||
fprintf_ln(stderr, _("warning in %s %s: %s"),
|
||||
printable_type(&obj->oid, obj->type),
|
||||
describe_object(&obj->oid), message);
|
||||
printable_type(oid, object_type),
|
||||
describe_object(oid), message);
|
||||
return 0;
|
||||
case FSCK_ERROR:
|
||||
/* TRANSLATORS: e.g. error in tree 01bfda: <more explanation> */
|
||||
fprintf_ln(stderr, _("error in %s %s: %s"),
|
||||
printable_type(&obj->oid, obj->type),
|
||||
describe_object(&obj->oid), message);
|
||||
printable_type(oid, object_type),
|
||||
describe_object(oid), message);
|
||||
return 1;
|
||||
default:
|
||||
BUG("%d (FSCK_IGNORE?) should never trigger this callback", type);
|
||||
BUG("%d (FSCK_IGNORE?) should never trigger this callback",
|
||||
msg_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user