@ -117,10 +117,8 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
list = sorted_by_sha;
list = sorted_by_sha;
for (i = 0; i < nr_objects; i++) {
for (i = 0; i < nr_objects; i++) {
struct pack_idx_entry *obj = *list++;
struct pack_idx_entry *obj = *list++;
if (index_version < 2) {
if (index_version < 2)
uint32_t offset = htonl(obj->offset);
hashwrite_be32(f, obj->offset);
hashwrite(f, &offset, 4);
}
hashwrite(f, obj->oid.hash, the_hash_algo->rawsz);
hashwrite(f, obj->oid.hash, the_hash_algo->rawsz);
if ((opts->flags & WRITE_IDX_STRICT) &&
if ((opts->flags & WRITE_IDX_STRICT) &&
(i && oideq(&list[-2]->oid, &obj->oid)))
(i && oideq(&list[-2]->oid, &obj->oid)))
@ -135,8 +133,7 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
list = sorted_by_sha;
list = sorted_by_sha;
for (i = 0; i < nr_objects; i++) {
for (i = 0; i < nr_objects; i++) {
struct pack_idx_entry *obj = *list++;
struct pack_idx_entry *obj = *list++;
uint32_t crc32_val = htonl(obj->crc32);
hashwrite_be32(f, obj->crc32);
hashwrite(f, &crc32_val, 4);
}
}
/* write the 32-bit offset table */
/* write the 32-bit offset table */
@ -148,8 +145,7 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec
offset = (need_large_offset(obj->offset, opts)
offset = (need_large_offset(obj->offset, opts)
? (0x80000000 | nr_large_offset++)
? (0x80000000 | nr_large_offset++)
: obj->offset);
: obj->offset);
offset = htonl(offset);
hashwrite_be32(f, offset);
hashwrite(f, &offset, 4);
}
}
/* write the large offset table */
/* write the large offset table */