MCPcopy Create free account
hub / github.com/git/git / fsck_obj

Function fsck_obj

builtin/fsck.c:404–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402}
403
404static 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
444out:
445 if (obj->type == OBJ_TREE)
446 free_tree_buffer((struct tree *)obj);
447 return err;
448}
449
450static int fsck_obj_buffer(const struct object_id *oid, enum object_type type,
451 unsigned long size, void *buffer, int *eaten, void *cb_data)

Callers 2

fsck_obj_bufferFunction · 0.85
fsck_looseFunction · 0.85

Calls 8

fprintf_lnFunction · 0.85
printable_typeFunction · 0.85
describe_objectFunction · 0.85
fsck_walkFunction · 0.85
objerrorFunction · 0.85
fsck_objectFunction · 0.85
printf_lnFunction · 0.85
free_tree_bufferFunction · 0.85

Tested by

no test coverage detected