builtin rebase: support --committer-date-is-author-date
[gitweb.git] / builtin / unpack-objects.c
index cfe9019f800ad0bd331e31a20a8b7a240dc3fde1..716408e3a9db7499e338905b68444c7dc0a3149f 100644 (file)
@@ -1,6 +1,7 @@
 #include "builtin.h"
 #include "cache.h"
 #include "config.h"
+#include "object-store.h"
 #include "object.h"
 #include "delta.h"
 #include "pack.h"
@@ -210,7 +211,7 @@ static int check_object(struct object *obj, int type, void *data, struct fsck_op
        if (!obj_buf)
                die("Whoops! Cannot find object '%s'", oid_to_hex(&obj->oid));
        if (fsck_object(obj, obj_buf->buffer, obj_buf->size, &fsck_options))
-               die("Error in object");
+               die("fsck error in packed object");
        fsck_options.walk = check_object;
        if (fsck_walk(obj, NULL, &fsck_options))
                die("Error on reachable objects of %s", oid_to_hex(&obj->oid));
@@ -253,7 +254,7 @@ static void write_object(unsigned nr, enum object_type type,
                added_object(nr, type, buf, size);
                free(buf);
 
-               blob = lookup_blob(&obj_list[nr].oid);
+               blob = lookup_blob(the_repository, &obj_list[nr].oid);
                if (blob)
                        blob->object.flags |= FLAG_WRITTEN;
                else
@@ -264,7 +265,8 @@ static void write_object(unsigned nr, enum object_type type,
                int eaten;
                hash_object_file(buf, size, type_name(type), &obj_list[nr].oid);
                added_object(nr, type, buf, size);
-               obj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,
+               obj = parse_object_buffer(the_repository, &obj_list[nr].oid,
+                                         type, size, buf,
                                          &eaten);
                if (!obj)
                        die("invalid %s", type_name(type));
@@ -330,7 +332,7 @@ static int resolve_against_held(unsigned nr, const struct object_id *base,
 {
        struct object *obj;
        struct obj_buffer *obj_buffer;
-       obj = lookup_object(base->hash);
+       obj = lookup_object(the_repository, base->hash);
        if (!obj)
                return 0;
        obj_buffer = lookup_object_buffer(obj);
@@ -572,8 +574,11 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
        unpack_all();
        the_hash_algo->update_fn(&ctx, buffer, offset);
        the_hash_algo->final_fn(oid.hash, &ctx);
-       if (strict)
+       if (strict) {
                write_rest();
+               if (fsck_finish(&fsck_options))
+                       die(_("fsck error in pack objects"));
+       }
        if (hashcmp(fill(the_hash_algo->rawsz), oid.hash))
                die("final sha1 did not match");
        use(the_hash_algo->rawsz);