summaryrefslogtreecommitdiff
path: root/pack-bitmap-write.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2015-11-10 02:22:27 (GMT)
committerJeff King <peff@peff.net>2015-11-20 13:02:05 (GMT)
commit7999b2cf772956466baa8925491d6fb1b0963292 (patch)
tree34a3bf75c3cdc621d732107f53181ff28c0550a4 /pack-bitmap-write.c
parent3c4270107fec2c1d85b7b1a6f8b0aeebf3193b28 (diff)
downloadgit-7999b2cf772956466baa8925491d6fb1b0963292.zip
git-7999b2cf772956466baa8925491d6fb1b0963292.tar.gz
git-7999b2cf772956466baa8925491d6fb1b0963292.tar.bz2
Add several uses of get_object_hash.
Convert most instances where the sha1 member of struct object is dereferenced to use get_object_hash. Most instances that are passed to functions that have versions taking struct object_id, such as get_sha1_hex/get_oid_hex, or instances that can be trivially converted to use struct object_id instead, are not converted. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'pack-bitmap-write.c')
-rw-r--r--pack-bitmap-write.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index c05d138..03f1926 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -152,7 +152,7 @@ static void show_object(struct object *object, const struct name_path *path,
const char *last, void *data)
{
struct bitmap *base = data;
- bitmap_set(base, find_object_pos(object->sha1));
+ bitmap_set(base, find_object_pos(get_object_hash(*object)));
mark_as_seen(object);
}
@@ -165,12 +165,12 @@ static int
add_to_include_set(struct bitmap *base, struct commit *commit)
{
khiter_t hash_pos;
- uint32_t bitmap_pos = find_object_pos(commit->object.sha1);
+ uint32_t bitmap_pos = find_object_pos(get_object_hash(commit->object));
if (bitmap_get(base, bitmap_pos))
return 0;
- hash_pos = kh_get_sha1(writer.bitmaps, commit->object.sha1);
+ hash_pos = kh_get_sha1(writer.bitmaps, get_object_hash(commit->object));
if (hash_pos < kh_end(writer.bitmaps)) {
struct bitmapped_commit *bc = kh_value(writer.bitmaps, hash_pos);
bitmap_or_ewah(base, bc->bitmap);
@@ -308,7 +308,7 @@ void bitmap_writer_build(struct packing_data *to_pack)
if (i >= reuse_after)
stored->flags |= BITMAP_FLAG_REUSE;
- hash_pos = kh_put_sha1(writer.bitmaps, object->sha1, &hash_ret);
+ hash_pos = kh_put_sha1(writer.bitmaps, get_object_hash(*object), &hash_ret);
if (hash_ret == 0)
die("Duplicate entry when writing index: %s",
sha1_to_hex(object->sha1));
@@ -414,14 +414,14 @@ void bitmap_writer_select_commits(struct commit **indexed_commits,
if (next == 0) {
chosen = indexed_commits[i];
- reused_bitmap = find_reused_bitmap(chosen->object.sha1);
+ reused_bitmap = find_reused_bitmap(get_object_hash(chosen->object));
} else {
chosen = indexed_commits[i + next];
for (j = 0; j <= next; ++j) {
struct commit *cm = indexed_commits[i + j];
- reused_bitmap = find_reused_bitmap(cm->object.sha1);
+ reused_bitmap = find_reused_bitmap(get_object_hash(cm->object));
if (reused_bitmap || (cm->object.flags & NEEDS_BITMAP) != 0) {
chosen = cm;
break;
@@ -474,7 +474,7 @@ static void write_selected_commits_v1(struct sha1file *f,
struct bitmapped_commit *stored = &writer.selected[i];
int commit_pos =
- sha1_pos(stored->commit->object.sha1, index, index_nr, sha1_access);
+ sha1_pos(get_object_hash(stored->commit->object), index, index_nr, sha1_access);
if (commit_pos < 0)
die("BUG: trying to write commit not in index");