282
}
283
}
284
285
-static int fsck_sha1(const unsigned char *sha1)
285
+static int fsck_obj(struct object *obj)
286
{
287
- struct object *obj = parse_object(sha1);
288
- if (!obj) {
289
- errors_found |= ERROR_OBJECT;
290
- return error("%s: object corrupt or missing",
291
- sha1_to_hex(sha1));
292
- }
287
if (obj->flags & SEEN)
288
return 0;
289
obj->flags |= SEEN;
326
return 0;
327
}
328
329
+static int fsck_sha1(const unsigned char *sha1)
330
+{
331
+ struct object *obj = parse_object(sha1);
332
+ if (!obj) {
333
+ errors_found |= ERROR_OBJECT;
334
+ return error("%s: object corrupt or missing",
335
+ sha1_to_hex(sha1));
336
+ }
337
+ return fsck_obj(obj);
338
+}
339
+
340
+static int fsck_obj_buffer(const unsigned char *sha1, enum object_type type,
341
+ unsigned long size, void *buffer, int *eaten)
342
+{
343
+ struct object *obj;
344
+ obj = parse_object_buffer(sha1, type, size, buffer, eaten);
345
+ if (!obj) {
346
+ errors_found |= ERROR_OBJECT;
347
+ return error("%s: object corrupt or missing", sha1_to_hex(sha1));
348
+ }
349
+ return fsck_obj(obj);
350
+}
351
+
352
/*
353
* This is the sorting chunk size: make it reasonably
354
* big so that we can sort well..
644
prepare_packed_git();
645
for (p = packed_git; p; p = p->next)
646
/* verify gives error messages itself */
630
- if (verify_pack(p))
647
+ if (verify_pack(p, fsck_obj_buffer))
648
errors_found |= ERROR_PACK;
632
-
633
- for (p = packed_git; p; p = p->next) {
634
- uint32_t j, num;
635
- if (open_pack_index(p))
636
- continue;
637
- num = p->num_objects;
638
- for (j = 0; j < num; j++)
639
- fsck_sha1(nth_packed_object_sha1(p, j));
640
- }
649
}
650
651
heads = 0;