X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=fsck-cache.c;h=96b8eb161107cd3219975d93a44874a5455b702e;hb=b2c007186786c39693d42d18a1e491aa2e7defce;hp=b59e1b959c5d4cf54253534bb726442baf537949;hpb=ff5ebe39b0ca5cbdcbe11f092b5b43dbeada820e;p=git.git diff --git a/fsck-cache.c b/fsck-cache.c index b59e1b95..96b8eb16 100644 --- a/fsck-cache.c +++ b/fsck-cache.c @@ -21,7 +21,7 @@ static void check_connectivity(void) struct object *obj = objs[i]; if (show_unreachable && !(obj->flags & REACHABLE)) { - printf("unreachable %s\n", sha1_to_hex(obj->sha1)); + printf("unreachable %s %s\n", obj->type, sha1_to_hex(obj->sha1)); continue; } @@ -85,12 +85,13 @@ static int fsck_name(char *hex) if (map) { char type[100]; unsigned long size; - void *buffer = NULL; - if (!check_sha1_signature(sha1, map, mapsize)) - buffer = unpack_sha1_file(map, mapsize, type, - &size); + void *buffer = unpack_sha1_file(map, mapsize, type, &size); + if (!buffer) + return -1; + if (check_sha1_signature(sha1, buffer, size, type) < 0) + printf("sha1 mismatch %s\n", sha1_to_hex(sha1)); munmap(map, mapsize); - if (buffer && !fsck_entry(sha1, type, buffer, size)) + if (!fsck_entry(sha1, type, buffer, size)) return 0; } } @@ -149,8 +150,7 @@ int main(int argc, char **argv) continue; } if (!get_sha1_hex(argv[i], head_sha1)) { - struct object *obj = - &lookup_commit(head_sha1)->object; + struct object *obj = &lookup_commit(head_sha1)->object; obj->used = 1; mark_reachable(obj, REACHABLE); heads++;