summaryrefslogtreecommitdiff
path: root/pack-write.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-05-06 22:10:11 +0000
committerJunio C Hamano <gitster@pobox.com>2017-05-08 15:12:57 +0900
commite6a492b7beca9dc8b656f2be3aec23fc1a35e4de (patch)
tree15196180251faf3c1416aa460172872c194ab08d /pack-write.c
parentbc83266abe36905cade4719cbaeb8a62d0a382da (diff)
downloadgit-e6a492b7beca9dc8b656f2be3aec23fc1a35e4de.tar.gz
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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-write.c')
-rw-r--r--pack-write.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/pack-write.c b/pack-write.c
index fa97b72559..a333ec6754 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) {