diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2018-03-12 02:27:39 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-14 09:23:49 -0700 |
commit | 17e65451e305b7501fddec35125bf5d39a4cdcac (patch) | |
tree | ffd070759d814151fd56faebfa4a9b951eeaa240 /builtin | |
parent | sha1_file: convert read_loose_object to use struct object_id (diff) | |
download | tgif-17e65451e305b7501fddec35125bf5d39a4cdcac.tar.xz |
sha1_file: convert check_sha1_signature to struct object_id
Convert this function to take a pointer to struct object_id and rename
it check_object_signature. Introduce temporaries to convert the return
values of lookup_replace_object and lookup_replace_object_extended into
struct object_id.
The temporaries are needed because in order to convert
lookup_replace_object, open_istream needs to be converted, and
open_istream needs check_sha1_signature to be converted, causing a loop
of dependencies. The temporaries will be removed in a future patch.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fast-export.c | 2 | ||||
-rw-r--r-- | builtin/index-pack.c | 2 | ||||
-rw-r--r-- | builtin/mktag.c | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 27b2cc138e..9b049e9d08 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -240,7 +240,7 @@ static void export_blob(const struct object_id *oid) buf = read_sha1_file(oid->hash, &type, &size); if (!buf) die ("Could not read blob %s", oid_to_hex(oid)); - if (check_sha1_signature(oid->hash, buf, size, type_name(type)) < 0) + if (check_object_signature(oid, buf, size, type_name(type)) < 0) die("sha1 mismatch in blob %s", oid_to_hex(oid)); object = parse_object_buffer(oid, type, size, buf, &eaten); } diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 9744175e23..b28ebfadd4 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1377,7 +1377,7 @@ static void fix_unresolved_deltas(struct hashfile *f) if (!base_obj->data) continue; - if (check_sha1_signature(d->oid.hash, base_obj->data, + if (check_object_signature(&d->oid, base_obj->data, base_obj->size, type_name(type))) die(_("local object %s is corrupt"), oid_to_hex(&d->oid)); base_obj->obj = append_obj_to_pack(f, d->oid.hash, diff --git a/builtin/mktag.c b/builtin/mktag.c index 65bb41e3cd..810b24bef3 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -27,8 +27,11 @@ static int verify_object(const struct object_id *oid, const char *expected_type) const unsigned char *repl = lookup_replace_object(oid->hash); if (buffer) { + struct object_id reploid; + hashcpy(reploid.hash, repl); + if (type == type_from_string(expected_type)) - ret = check_sha1_signature(repl, buffer, size, expected_type); + ret = check_object_signature(&reploid, buffer, size, expected_type); free(buffer); } return ret; |