@matheusbsbs / matheus-bagliano / commits / f59793763d
Fork 0

fsck: only require an oid for skiplist functions

The skiplist is inherently an oidset, so we don't need a full object struct. Let's take just the oid to give our callers more flexibility. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 18, 2019 at 00:58 UTC f59793763deb970dd5acffe2dffd34e791d44df8
1 file changed +5 -4
fsck.c
+5 -4
@@ -277,9 +277,10 @@ static void append_msg_id(struct strbuf *sb, const char *msg_id)
277 strbuf_addstr(sb, ": ");
278 }
279
280 -static int object_on_skiplist(struct fsck_options *opts, struct object *obj)
280 +static int object_on_skiplist(struct fsck_options *opts,
281 + const struct object_id *oid)
282 {
282 - return opts && obj && oidset_contains(&opts->skiplist, &obj->oid);
283 + return opts && oid && oidset_contains(&opts->skiplist, oid);
284 }
285
286 __attribute__((format (printf, 4, 5)))
@@ -293,7 +294,7 @@ static int report(struct fsck_options *options, struct object *object,
294 if (msg_type == FSCK_IGNORE)
295 return 0;
296
296 - if (object_on_skiplist(options, object))
297 + if (object_on_skiplist(options, &object->oid))
298 return 0;
299
300 if (msg_type == FSCK_FATAL)
@@ -935,7 +936,7 @@ static int fsck_blob(struct blob *blob, const char *buf,
936 return 0;
937 oidset_insert(&gitmodules_done, &blob->object.oid);
938
938 - if (object_on_skiplist(options, &blob->object))
939 + if (object_on_skiplist(options, &blob->object.oid))
940 return 0;
941
942 if (!buf) {