diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2018-03-12 03:27:54 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-14 17:23:50 +0100 |
commit | b383a13cc0dbed752b69d7ad249bc857b9d3607b (patch) | |
tree | ab9434ad4444be32900ba7fa76211124a9f4a4cd /object.c | |
parent | sha1_file: convert read_sha1_file to struct object_id (diff) | |
download | git-b383a13cc0dbed752b69d7ad249bc857b9d3607b.tar.xz git-b383a13cc0dbed752b69d7ad249bc857b9d3607b.zip |
Convert lookup_replace_object to struct object_id
Convert both the argument and the return value to be pointers to struct
object_id. Update the callers and their internals to deal with the new
type. Remove several temporaries which are no longer needed.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -244,7 +244,7 @@ struct object *parse_object(const struct object_id *oid) unsigned long size; enum object_type type; int eaten; - const unsigned char *repl = lookup_replace_object(oid->hash); + const struct object_id *repl = lookup_replace_object(oid); void *buffer; struct object *obj; @@ -255,10 +255,7 @@ struct object *parse_object(const struct object_id *oid) if ((obj && obj->type == OBJ_BLOB && has_object_file(oid)) || (!obj && has_object_file(oid) && oid_object_info(oid, NULL) == OBJ_BLOB)) { - struct object_id reploid; - hashcpy(reploid.hash, repl); - - if (check_object_signature(&reploid, NULL, 0, NULL) < 0) { + if (check_object_signature(repl, NULL, 0, NULL) < 0) { error("sha1 mismatch %s", oid_to_hex(oid)); return NULL; } @@ -268,12 +265,9 @@ struct object *parse_object(const struct object_id *oid) buffer = read_object_file(oid, &type, &size); if (buffer) { - struct object_id reploid; - hashcpy(reploid.hash, repl); - - if (check_object_signature(&reploid, buffer, size, type_name(type)) < 0) { + if (check_object_signature(repl, buffer, size, type_name(type)) < 0) { free(buffer); - error("sha1 mismatch %s", sha1_to_hex(repl)); + error("sha1 mismatch %s", oid_to_hex(repl)); return NULL; } |