summaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-03-12 02:27:44 +0000
committerJunio C Hamano <gitster@pobox.com>2018-03-14 09:23:49 -0700
commit4310b0c441e51fbba13888cb1373d27efcc018ef (patch)
tree85fa68ff6bd42fe7c69ac9e33310f540ffba6dce /packfile.c
parentd169d6644cec9bbb244c8300cadcd89afd4193cb (diff)
downloadgit-4310b0c441e51fbba13888cb1373d27efcc018ef.tar.gz
packfile: convert unpack_entry to struct object_id
Convert unpack_entry and read_object to use struct object_id. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/packfile.c b/packfile.c
index 5f08aa0a14..3e31ad7a0c 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1452,7 +1452,7 @@ struct unpack_entry_stack_ent {
unsigned long size;
};
-static void *read_object(const unsigned char *sha1, enum object_type *type,
+static void *read_object(const struct object_id *oid, enum object_type *type,
unsigned long *size)
{
struct object_info oi = OBJECT_INFO_INIT;
@@ -1461,7 +1461,7 @@ static void *read_object(const unsigned char *sha1, enum object_type *type,
oi.sizep = size;
oi.contentp = &content;
- if (sha1_object_info_extended(sha1, &oi, 0) < 0)
+ if (sha1_object_info_extended(oid->hash, &oi, 0) < 0)
return NULL;
return content;
}
@@ -1501,11 +1501,11 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
struct revindex_entry *revidx = find_pack_revindex(p, obj_offset);
off_t len = revidx[1].offset - obj_offset;
if (check_pack_crc(p, &w_curs, obj_offset, len, revidx->nr)) {
- const unsigned char *sha1 =
- nth_packed_object_sha1(p, revidx->nr);
+ struct object_id oid;
+ nth_packed_object_oid(&oid, p, revidx->nr);
error("bad packed object CRC for %s",
- sha1_to_hex(sha1));
- mark_bad_packed_object(p, sha1);
+ oid_to_hex(&oid));
+ mark_bad_packed_object(p, oid.hash);
data = NULL;
goto out;
}
@@ -1588,16 +1588,16 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
* of a corrupted pack, and is better than failing outright.
*/
struct revindex_entry *revidx;
- const unsigned char *base_sha1;
+ struct object_id base_oid;
revidx = find_pack_revindex(p, obj_offset);
if (revidx) {
- base_sha1 = nth_packed_object_sha1(p, revidx->nr);
+ nth_packed_object_oid(&base_oid, p, revidx->nr);
error("failed to read delta base object %s"
" at offset %"PRIuMAX" from %s",
- sha1_to_hex(base_sha1), (uintmax_t)obj_offset,
+ oid_to_hex(&base_oid), (uintmax_t)obj_offset,
p->pack_name);
- mark_bad_packed_object(p, base_sha1);
- base = read_object(base_sha1, &type, &base_size);
+ mark_bad_packed_object(p, base_oid.hash);
+ base = read_object(&base_oid, &type, &base_size);
external_base = base;
}
}