summaryrefslogtreecommitdiff
path: root/fsck.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2019-10-18 04:58:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-10-28 05:05:18 (GMT)
commitf59793763deb970dd5acffe2dffd34e791d44df8 (patch)
tree2f5ad6b11d182f3ed5c0badcdbcaaf96855a3979 /fsck.c
parent5afc4b1dc622d574bcd67b5845789a0b5875431a (diff)
downloadgit-f59793763deb970dd5acffe2dffd34e791d44df8.zip
git-f59793763deb970dd5acffe2dffd34e791d44df8.tar.gz
git-f59793763deb970dd5acffe2dffd34e791d44df8.tar.bz2
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>
Diffstat (limited to 'fsck.c')
-rw-r--r--fsck.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fsck.c b/fsck.c
index c036ba0..2309c40 100644
--- a/fsck.c
+++ b/fsck.c
@@ -277,9 +277,10 @@ static void append_msg_id(struct strbuf *sb, const char *msg_id)
strbuf_addstr(sb, ": ");
}
-static int object_on_skiplist(struct fsck_options *opts, struct object *obj)
+static int object_on_skiplist(struct fsck_options *opts,
+ const struct object_id *oid)
{
- return opts && obj && oidset_contains(&opts->skiplist, &obj->oid);
+ return opts && oid && oidset_contains(&opts->skiplist, oid);
}
__attribute__((format (printf, 4, 5)))
@@ -293,7 +294,7 @@ static int report(struct fsck_options *options, struct object *object,
if (msg_type == FSCK_IGNORE)
return 0;
- if (object_on_skiplist(options, object))
+ if (object_on_skiplist(options, &object->oid))
return 0;
if (msg_type == FSCK_FATAL)
@@ -935,7 +936,7 @@ static int fsck_blob(struct blob *blob, const char *buf,
return 0;
oidset_insert(&gitmodules_done, &blob->object.oid);
- if (object_on_skiplist(options, &blob->object))
+ if (object_on_skiplist(options, &blob->object.oid))
return 0;
if (!buf) {