]> git.ipfire.org Git - thirdparty/git.git/blobdiff - object.c
Convert remaining callers of lookup_blob to object_id
[thirdparty/git.git] / object.c
index e680d881a45756eb234a80a9909c24a7b146c1f7..0208c407a6e829f4ad76d347d559470c0ee08475 100644 (file)
--- a/object.c
+++ b/object.c
@@ -182,12 +182,15 @@ struct object *lookup_unknown_object(const unsigned char *sha1)
 
 struct object *parse_object_buffer(const unsigned char *sha1, enum object_type type, unsigned long size, void *buffer, int *eaten_p)
 {
+       struct object_id oid;
        struct object *obj;
        *eaten_p = 0;
 
+       hashcpy(oid.hash, sha1);
+
        obj = NULL;
        if (type == OBJ_BLOB) {
-               struct blob *blob = lookup_blob(sha1);
+               struct blob *blob = lookup_blob(oid.hash);
                if (blob) {
                        if (parse_blob_buffer(blob, buffer, size))
                                return NULL;
@@ -206,7 +209,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
                        }
                }
        } else if (type == OBJ_COMMIT) {
-               struct commit *commit = lookup_commit(sha1);
+               struct commit *commit = lookup_commit(&oid);
                if (commit) {
                        if (parse_commit_buffer(commit, buffer, size))
                                return NULL;
@@ -248,8 +251,11 @@ struct object *parse_object(const unsigned char *sha1)
        const unsigned char *repl = lookup_replace_object(sha1);
        void *buffer;
        struct object *obj;
+       struct object_id oid;
+
+       hashcpy(oid.hash, sha1);
 
-       obj = lookup_object(sha1);
+       obj = lookup_object(oid.hash);
        if (obj && obj->parsed)
                return obj;
 
@@ -260,7 +266,7 @@ struct object *parse_object(const unsigned char *sha1)
                        error("sha1 mismatch %s", sha1_to_hex(repl));
                        return NULL;
                }
-               parse_blob_buffer(lookup_blob(sha1), NULL, 0);
+               parse_blob_buffer(lookup_blob(oid.hash), NULL, 0);
                return lookup_object(sha1);
        }