sha1_file: convert read_sha1_file to struct object_id
[gitweb.git] / builtin / unpack-objects.c
index 7235d2ffbff78400384f92ea53233ec4dfbf0687..af02e1bc6b3062a1863e798cd9812bbe9dac50bc 100644 (file)
@@ -173,7 +173,7 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
        struct object_id oid;
 
        if (write_object_file(obj_buf->buffer, obj_buf->size,
-                             typename(obj->type), &oid) < 0)
+                             type_name(obj->type), &oid) < 0)
                die("failed to write object %s", oid_to_hex(&obj->oid));
        obj->flags |= FLAG_WRITTEN;
 }
@@ -198,7 +198,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->oid.hash, &size);
+               int type = oid_object_info(&obj->oid, &size);
                if (type != obj->type || type <= 0)
                        die("object of unexpected type");
                obj->flags |= FLAG_WRITTEN;
@@ -238,7 +238,7 @@ static void write_object(unsigned nr, enum object_type type,
                         void *buf, unsigned long size)
 {
        if (!strict) {
-               if (write_object_file(buf, size, typename(type),
+               if (write_object_file(buf, size, type_name(type),
                                      &obj_list[nr].oid) < 0)
                        die("failed to write object");
                added_object(nr, type, buf, size);
@@ -246,7 +246,7 @@ static void write_object(unsigned nr, enum object_type type,
                obj_list[nr].obj = NULL;
        } else if (type == OBJ_BLOB) {
                struct blob *blob;
-               if (write_object_file(buf, size, typename(type),
+               if (write_object_file(buf, size, type_name(type),
                                      &obj_list[nr].oid) < 0)
                        die("failed to write object");
                added_object(nr, type, buf, size);
@@ -261,12 +261,12 @@ static void write_object(unsigned nr, enum object_type type,
        } else {
                struct object *obj;
                int eaten;
-               hash_object_file(buf, size, typename(type), &obj_list[nr].oid);
+               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,
                                          &eaten);
                if (!obj)
-                       die("invalid %s", typename(type));
+                       die("invalid %s", type_name(type));
                add_object_buffer(obj, buf, size);
                obj->flags |= FLAG_OPEN;
                obj_list[nr].obj = obj;
@@ -422,7 +422,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
        if (resolve_against_held(nr, &base_oid, delta_data, delta_size))
                return;
 
-       base = read_sha1_file(base_oid.hash, &type, &base_size);
+       base = read_object_file(&base_oid, &type, &base_size);
        if (!base) {
                error("failed to read delta-pack base object %s",
                      oid_to_hex(&base_oid));