sha1_file: convert read_object_with_reference to object_id
[gitweb.git] / object.c
index 0db33b26bae383a03dd56c3f2352e0301105d75e..4063e955dba1c32de6bd878324df858be3b0f164 100644 (file)
--- a/object.c
+++ b/object.c
@@ -252,10 +252,13 @@ struct object *parse_object(const struct object_id *oid)
        if (obj && obj->parsed)
                return obj;
 
-       if ((obj && obj->type == OBJ_BLOB) ||
+       if ((obj && obj->type == OBJ_BLOB && has_object_file(oid)) ||
            (!obj && has_object_file(oid) &&
-            sha1_object_info(oid->hash, NULL) == OBJ_BLOB)) {
-               if (check_sha1_signature(repl, NULL, 0, NULL) < 0) {
+            oid_object_info(oid, NULL) == OBJ_BLOB)) {
+               struct object_id reploid;
+               hashcpy(reploid.hash, repl);
+
+               if (check_object_signature(&reploid, NULL, 0, NULL) < 0) {
                        error("sha1 mismatch %s", oid_to_hex(oid));
                        return NULL;
                }
@@ -265,7 +268,10 @@ struct object *parse_object(const struct object_id *oid)
 
        buffer = read_sha1_file(oid->hash, &type, &size);
        if (buffer) {
-               if (check_sha1_signature(repl, buffer, size, type_name(type)) < 0) {
+               struct object_id reploid;
+               hashcpy(reploid.hash, repl);
+
+               if (check_object_signature(&reploid, buffer, size, type_name(type)) < 0) {
                        free(buffer);
                        error("sha1 mismatch %s", sha1_to_hex(repl));
                        return NULL;