apply: make init_apply_state() return -1 instead of exit()ing
[gitweb.git] / builtin / unpack-objects.c
index 7c3e79c48d68251f8af94d91ef51d22567c53c07..172470bf241e4da731c5741567555d7e01691c74 100644 (file)
@@ -46,7 +46,7 @@ static void add_object_buffer(struct object *object, char *buffer, unsigned long
        obj->buffer = buffer;
        obj->size = size;
        if (add_decoration(&obj_decorate, object, obj))
-               die("object %s tried to add buffer twice!", sha1_to_hex(object->sha1));
+               die("object %s tried to add buffer twice!", oid_to_hex(&object->oid));
 }
 
 /*
@@ -170,7 +170,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
        unsigned char sha1[20];
 
        if (write_sha1_file(obj_buf->buffer, obj_buf->size, typename(obj->type), sha1) < 0)
-               die("failed to write object %s", sha1_to_hex(obj->sha1));
+               die("failed to write object %s", oid_to_hex(&obj->oid));
        obj->flags |= FLAG_WRITTEN;
 }
 
@@ -194,7 +194,7 @@ static int check_object(struct object *obj, int type, void *data, struct fsck_op
 
        if (!(obj->flags & FLAG_OPEN)) {
                unsigned long size;
-               int type = sha1_object_info(obj->sha1, &size);
+               int type = sha1_object_info(obj->oid.hash, &size);
                if (type != obj->type || type <= 0)
                        die("object of unexpected type");
                obj->flags |= FLAG_WRITTEN;
@@ -203,12 +203,12 @@ static int check_object(struct object *obj, int type, void *data, struct fsck_op
 
        obj_buf = lookup_object_buffer(obj);
        if (!obj_buf)
-               die("Whoops! Cannot find object '%s'", sha1_to_hex(obj->sha1));
+               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");
        fsck_options.walk = check_object;
        if (fsck_walk(obj, NULL, &fsck_options))
-               die("Error on reachable objects of %s", sha1_to_hex(obj->sha1));
+               die("Error on reachable objects of %s", oid_to_hex(&obj->oid));
        write_cached_object(obj, obj_buf);
        return 0;
 }
@@ -355,7 +355,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
                        return; /* we are done */
                else {
                        /* cannot resolve yet --- queue it */
-                       hashcpy(obj_list[nr].sha1, null_sha1);
+                       hashclr(obj_list[nr].sha1);
                        add_delta_to_list(nr, base_sha1, 0, delta_data, delta_size);
                        return;
                }
@@ -406,7 +406,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
                         * The delta base object is itself a delta that
                         * has not been resolved yet.
                         */
-                       hashcpy(obj_list[nr].sha1, null_sha1);
+                       hashclr(obj_list[nr].sha1);
                        add_delta_to_list(nr, null_sha1, base_offset, delta_data, delta_size);
                        return;
                }