summaryrefslogtreecommitdiff
path: root/pack-bitmap.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-03-05 18:43:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-05 18:43:03 (GMT)
commite8e71848ea866d7dc34eacffc20b9c3826ae29a1 (patch)
tree3baa258f1b1a5671948b7677169b0af70a06dc06 /pack-bitmap.c
parenta0ab37de61c9ac7f57105d6b170947abaf1b642c (diff)
parent2fecc48cade44529dff2594eadfb294643cdc24d (diff)
downloadgit-e8e71848ea866d7dc34eacffc20b9c3826ae29a1.zip
git-e8e71848ea866d7dc34eacffc20b9c3826ae29a1.tar.gz
git-e8e71848ea866d7dc34eacffc20b9c3826ae29a1.tar.bz2
Merge branch 'jk/nth-packed-object-id'
Code cleanup to use "struct object_id" more by replacing use of "char *sha1" * jk/nth-packed-object-id: packfile: drop nth_packed_object_sha1() packed_object_info(): use object_id internally for delta base packed_object_info(): use object_id for returning delta base pack-check: push oid lookup into loop pack-check: convert "internal error" die to a BUG() pack-bitmap: use object_id when loading on-disk bitmaps pack-objects: use object_id struct in pack-reuse code pack-objects: convert oe_set_delta_ext() to use object_id pack-objects: read delta base oid into object_id struct nth_packed_object_oid(): use customary integer return
Diffstat (limited to 'pack-bitmap.c')
-rw-r--r--pack-bitmap.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/pack-bitmap.c b/pack-bitmap.c
index 82bfd66..49a8d10 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -170,7 +170,7 @@ static int load_bitmap_header(struct bitmap_index *index)
static struct stored_bitmap *store_bitmap(struct bitmap_index *index,
struct ewah_bitmap *root,
- const unsigned char *hash,
+ const struct object_id *oid,
struct stored_bitmap *xor_with,
int flags)
{
@@ -182,7 +182,7 @@ static struct stored_bitmap *store_bitmap(struct bitmap_index *index,
stored->root = root;
stored->xor = xor_with;
stored->flags = flags;
- oidread(&stored->oid, hash);
+ oidcpy(&stored->oid, oid);
hash_pos = kh_put_oid_map(index->bitmaps, stored->oid, &ret);
@@ -190,7 +190,7 @@ static struct stored_bitmap *store_bitmap(struct bitmap_index *index,
* because the SHA1 already existed on the map. this is bad, there
* shouldn't be duplicated commits in the index */
if (ret == 0) {
- error("Duplicate entry in bitmap index: %s", hash_to_hex(hash));
+ error("Duplicate entry in bitmap index: %s", oid_to_hex(oid));
return NULL;
}
@@ -222,13 +222,13 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
struct ewah_bitmap *bitmap = NULL;
struct stored_bitmap *xor_bitmap = NULL;
uint32_t commit_idx_pos;
- const unsigned char *sha1;
+ struct object_id oid;
commit_idx_pos = read_be32(index->map, &index->map_pos);
xor_offset = read_u8(index->map, &index->map_pos);
flags = read_u8(index->map, &index->map_pos);
- sha1 = nth_packed_object_sha1(index->pack, commit_idx_pos);
+ nth_packed_object_id(&oid, index->pack, commit_idx_pos);
bitmap = read_bitmap_1(index);
if (!bitmap)
@@ -245,7 +245,7 @@ static int load_bitmap_entries_v1(struct bitmap_index *index)
}
recent_bitmaps[i % MAX_XOR_OFFSET] = store_bitmap(
- index, bitmap, sha1, xor_bitmap, flags);
+ index, bitmap, &oid, xor_bitmap, flags);
}
return 0;
@@ -691,7 +691,7 @@ static void show_objects_for_type(
offset += ewah_bit_ctz64(word >> offset);
entry = &bitmap_git->pack->revindex[pos + offset];
- nth_packed_object_oid(&oid, bitmap_git->pack, entry->nr);
+ nth_packed_object_id(&oid, bitmap_git->pack, entry->nr);
if (bitmap_git->hashes)
hash = get_be32(bitmap_git->hashes + entry->nr);
@@ -796,7 +796,7 @@ static unsigned long get_size_by_pos(struct bitmap_index *bitmap_git,
if (packed_object_info(the_repository, pack,
entry->offset, &oi) < 0) {
struct object_id oid;
- nth_packed_object_oid(&oid, pack, entry->nr);
+ nth_packed_object_id(&oid, pack, entry->nr);
die(_("unable to get size of %s"), oid_to_hex(&oid));
}
} else {
@@ -1342,7 +1342,7 @@ int rebuild_existing_bitmaps(struct bitmap_index *bitmap_git,
struct object_entry *oe;
entry = &bitmap_git->pack->revindex[i];
- nth_packed_object_oid(&oid, bitmap_git->pack, entry->nr);
+ nth_packed_object_id(&oid, bitmap_git->pack, entry->nr);
oe = packlist_find(mapping, &oid);
if (oe)