From e6a492b7beca9dc8b656f2be3aec23fc1a35e4de Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sat, 6 May 2017 22:10:11 +0000 Subject: pack: convert struct pack_idx_entry to struct object_id Convert struct pack_idx_entry to use struct object_id by changing the definition and applying the following semantic patch, plus the standard object_id transforms: @@ struct pack_idx_entry E1; @@ - E1.sha1 + E1.oid.hash @@ struct pack_idx_entry *E1; @@ - E1->sha1 + E1->oid.hash Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- pack-write.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pack-write.c') diff --git a/pack-write.c b/pack-write.c index fa97b7255..a333ec675 100644 --- a/pack-write.c +++ b/pack-write.c @@ -13,7 +13,7 @@ static int sha1_compare(const void *_a, const void *_b) { struct pack_idx_entry *a = *(struct pack_idx_entry **)_a; struct pack_idx_entry *b = *(struct pack_idx_entry **)_b; - return hashcmp(a->sha1, b->sha1); + return oidcmp(&a->oid, &b->oid); } static int cmp_uint32(const void *a_, const void *b_) @@ -103,7 +103,7 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec struct pack_idx_entry **next = list; while (next < last) { struct pack_idx_entry *obj = *next; - if (obj->sha1[0] != i) + if (obj->oid.hash[0] != i) break; next++; } @@ -122,11 +122,11 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec uint32_t offset = htonl(obj->offset); sha1write(f, &offset, 4); } - sha1write(f, obj->sha1, 20); + sha1write(f, obj->oid.hash, 20); if ((opts->flags & WRITE_IDX_STRICT) && - (i && !hashcmp(list[-2]->sha1, obj->sha1))) + (i && !oidcmp(&list[-2]->oid, &obj->oid))) die("The same object %s appears twice in the pack", - sha1_to_hex(obj->sha1)); + oid_to_hex(&obj->oid)); } if (index_version >= 2) { -- cgit v1.2.1