X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-unpack-objects.c;h=685566e0b5e458c510fdf989744d63dda29e28f0;hb=28754ab5f0ce9b4f6ca1641c3e10e2c68bd9b3fc;hp=557148a693c058f51222cb3d996c309791d43d8b;hpb=d1926f63ec93e84dba1a54c5de898fb517d9ca59;p=git.git diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c index 557148a69..685566e0b 100644 --- a/builtin-unpack-objects.c +++ b/builtin-unpack-objects.c @@ -181,10 +181,10 @@ static void write_cached_object(struct object *obj) static int check_object(struct object *obj, int type, void *data) { if (!obj) - return 0; + return 1; if (obj->flags & FLAG_WRITTEN) - return 1; + return 0; if (type != OBJ_ANY && obj->type != type) die("object type mismatch"); @@ -195,22 +195,24 @@ static int check_object(struct object *obj, int type, void *data) if (type != obj->type || type <= 0) die("object of unexpected type"); obj->flags |= FLAG_WRITTEN; - return 1; + return 0; } if (fsck_object(obj, 1, fsck_error_function)) die("Error in object"); - if (!fsck_walk(obj, check_object, NULL)) + if (fsck_walk(obj, check_object, NULL)) die("Error on reachable objects of %s", sha1_to_hex(obj->sha1)); write_cached_object(obj); - return 1; + return 0; } static void write_rest(void) { unsigned i; - for (i = 0; i < nr_objects; i++) - check_object(obj_list[i].obj, OBJ_ANY, NULL); + for (i = 0; i < nr_objects; i++) { + if (obj_list[i].obj) + check_object(obj_list[i].obj, OBJ_ANY, NULL); + } } static void added_object(unsigned nr, enum object_type type, @@ -495,6 +497,8 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix) int i; unsigned char sha1[20]; + read_replace_refs = 0; + git_config(git_default_config, NULL); quiet = !isatty(2);