pretty: allow %(trailers) options with explicit value
[gitweb.git] / builtin / unpack-objects.c
index c8f1406d2340c5cf2c1ac775039e32a244fede33..80478808b3dcc7f98e5989140de1451783454c01 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"
@@ -199,7 +200,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(the_repository, &obj->oid, &size);
                if (type != obj->type || type <= 0)
                        die("object of unexpected type");
                obj->flags |= FLAG_WRITTEN;
@@ -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));
@@ -301,7 +303,7 @@ static void added_object(unsigned nr, enum object_type type,
        struct delta_info *info;
 
        while ((info = *p) != NULL) {
-               if (!oidcmp(&info->base_oid, &obj_list[nr].oid) ||
+               if (oideq(&info->base_oid, &obj_list[nr].oid) ||
                    info->base_offset == obj_list[nr].offset) {
                        *p = info->next;
                        p = &delta_list;
@@ -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);
@@ -423,7 +425,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));
@@ -512,7 +514,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
        int i;
        struct object_id oid;
 
-       check_replace_refs = 0;
+       read_replace_refs = 0;
 
        git_config(git_default_config, NULL);
 
@@ -577,7 +579,7 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
                if (fsck_finish(&fsck_options))
                        die(_("fsck error in pack objects"));
        }
-       if (hashcmp(fill(the_hash_algo->rawsz), oid.hash))
+       if (!hasheq(fill(the_hash_algo->rawsz), oid.hash))
                die("final sha1 did not match");
        use(the_hash_algo->rawsz);