diff options
author | Jeff King <peff@peff.net> | 2019-10-18 06:58:40 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-28 06:05:18 +0100 |
commit | 5afc4b1dc622d574bcd67b5845789a0b5875431a (patch) | |
tree | 0f890ebb095a065683e67f963bc58f762520f684 /fsck.c | |
parent | fsck: don't require object structs for display functions (diff) | |
download | git-5afc4b1dc622d574bcd67b5845789a0b5875431a.tar.xz git-5afc4b1dc622d574bcd67b5845789a0b5875431a.zip |
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>
Diffstat (limited to 'fsck.c')
-rw-r--r-- | fsck.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -305,7 +305,8 @@ static int report(struct fsck_options *options, struct object *object, va_start(ap, fmt); strbuf_vaddf(&sb, fmt, ap); - result = options->error_func(options, object, msg_type, sb.buf); + result = options->error_func(options, &object->oid, object->type, + msg_type, sb.buf); strbuf_release(&sb); va_end(ap); @@ -983,13 +984,15 @@ int fsck_object(struct object *obj, void *data, unsigned long size, } int fsck_error_function(struct fsck_options *o, - struct object *obj, int msg_type, const char *message) + const struct object_id *oid, + enum object_type object_type, + int msg_type, const char *message) { if (msg_type == FSCK_WARN) { - warning("object %s: %s", fsck_describe_object(o, &obj->oid), message); + warning("object %s: %s", fsck_describe_object(o, oid), message); return 0; } - error("object %s: %s", fsck_describe_object(o, &obj->oid), message); + error("object %s: %s", fsck_describe_object(o, oid), message); return 1; } |