pack-bitmap: convert traverse_bitmap_commit_list to object_id
Convert traverse_bitmap_commit_list and the callbacks it takes to use a pointer to struct object_id. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Oct 15, 2017 at 22:07 UTC
206649672e9cae1af7f1e23ea6648b39d73b71a4
4 files changed
+11
-11
builtin/pack-objects.c
+4
-4
@@ -1097,20 +1097,20 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
1097
return 1;
1098
}
1099
1100
-static int add_object_entry_from_bitmap(const unsigned char *sha1,
1100
+static int add_object_entry_from_bitmap(const struct object_id *oid,
1101
enum object_type type,
1102
int flags, uint32_t name_hash,
1103
struct packed_git *pack, off_t offset)
1104
{
1105
uint32_t index_pos;
1106
1107
- if (have_duplicate_entry(sha1, 0, &index_pos))
1107
+ if (have_duplicate_entry(oid->hash, 0, &index_pos))
1108
return 0;
1109
1110
- if (!want_object_in_pack(sha1, 0, &pack, &offset))
1110
+ if (!want_object_in_pack(oid->hash, 0, &pack, &offset))
1111
return 0;
1112
1113
- create_object_entry(sha1, type, name_hash, 0, 0, index_pos, pack, offset);
1113
+ create_object_entry(oid->hash, type, name_hash, 0, 0, index_pos, pack, offset);
1114
1115
display_progress(progress_state, nr_result);
1116
return 1;
builtin/rev-list.c
+2
-2
@@ -258,14 +258,14 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
258
}
259
260
static int show_object_fast(
261
- const unsigned char *sha1,
261
+ const struct object_id *oid,
262
enum object_type type,
263
int exclude,
264
uint32_t name_hash,
265
struct packed_git *found_pack,
266
off_t found_offset)
267
{
268
- fprintf(stdout, "%s\n", sha1_to_hex(sha1));
268
+ fprintf(stdout, "%s\n", oid_to_hex(oid));
269
return 1;
270
}
271
pack-bitmap.c
+4
-4
@@ -587,7 +587,7 @@ static void show_extended_objects(struct bitmap *objects,
587
continue;
588
589
obj = eindex->objects[i];
590
- show_reach(obj->oid.hash, obj->type, 0, eindex->hashes[i], NULL, 0);
590
+ show_reach(&obj->oid, obj->type, 0, eindex->hashes[i], NULL, 0);
591
}
592
}
593
@@ -612,7 +612,7 @@ static void show_objects_for_type(
612
eword_t word = objects->words[i] & filter;
613
614
for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
615
- const unsigned char *sha1;
615
+ struct object_id oid;
616
struct revindex_entry *entry;
617
uint32_t hash = 0;
618
@@ -625,12 +625,12 @@ static void show_objects_for_type(
625
continue;
626
627
entry = &bitmap_git.pack->revindex[pos + offset];
628
- sha1 = nth_packed_object_sha1(bitmap_git.pack, entry->nr);
628
+ nth_packed_object_oid(&oid, bitmap_git.pack, entry->nr);
629
630
if (bitmap_git.hashes)
631
hash = get_be32(bitmap_git.hashes + entry->nr);
632
633
- show_reach(sha1, object_type, 0, hash, bitmap_git.pack, entry->offset);
633
+ show_reach(&oid, object_type, 0, hash, bitmap_git.pack, entry->offset);
634
}
635
636
pos += BITS_IN_EWORD;
pack-bitmap.h
+1
-1
@@ -27,7 +27,7 @@ enum pack_bitmap_flags {
27
};
28
29
typedef int (*show_reachable_fn)(
30
- const unsigned char *sha1,
30
+ const struct object_id *oid,
31
enum object_type type,
32
int flags,
33
uint32_t hash,