| 402 | } |
| 403 | |
| 404 | static int fsck_obj(struct repository *repo, |
| 405 | struct object *obj, void *buffer, unsigned long size) |
| 406 | { |
| 407 | int err; |
| 408 | |
| 409 | if (obj->flags & SEEN) |
| 410 | return 0; |
| 411 | obj->flags |= SEEN; |
| 412 | |
| 413 | if (verbose) |
| 414 | fprintf_ln(stderr, _("Checking %s %s"), |
| 415 | printable_type(repo, &obj->oid, obj->type), |
| 416 | describe_object(&obj->oid)); |
| 417 | |
| 418 | if (fsck_walk(obj, NULL, &fsck_obj_options)) |
| 419 | objerror(repo, obj, _("broken links")); |
| 420 | err = fsck_object(obj, buffer, size, &fsck_obj_options); |
| 421 | if (err) |
| 422 | goto out; |
| 423 | |
| 424 | if (obj->type == OBJ_COMMIT) { |
| 425 | struct commit *commit = (struct commit *) obj; |
| 426 | |
| 427 | if (!commit->parents && show_root) |
| 428 | printf_ln(_("root %s"), |
| 429 | describe_object(&commit->object.oid)); |
| 430 | } |
| 431 | |
| 432 | if (obj->type == OBJ_TAG) { |
| 433 | struct tag *tag = (struct tag *) obj; |
| 434 | |
| 435 | if (show_tags && tag->tagged) { |
| 436 | printf_ln(_("tagged %s %s (%s) in %s"), |
| 437 | printable_type(repo, &tag->tagged->oid, tag->tagged->type), |
| 438 | describe_object(&tag->tagged->oid), |
| 439 | tag->tag, |
| 440 | describe_object(&tag->object.oid)); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | out: |
| 445 | if (obj->type == OBJ_TREE) |
| 446 | free_tree_buffer((struct tree *)obj); |
| 447 | return err; |
| 448 | } |
| 449 | |
| 450 | static int fsck_obj_buffer(const struct object_id *oid, enum object_type type, |
| 451 | unsigned long size, void *buffer, int *eaten, void *cb_data) |
no test coverage detected