Skip to content

Commit 2066496

Browse files
bk2204gitster
authored andcommitted
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>
1 parent 334dc52 commit 2066496

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

builtin/pack-objects.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,20 +1097,20 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
10971097
return 1;
10981098
}
10991099

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,
11011101
enum object_type type,
11021102
int flags, uint32_t name_hash,
11031103
struct packed_git *pack, off_t offset)
11041104
{
11051105
uint32_t index_pos;
11061106

1107-
if (have_duplicate_entry(sha1, 0, &index_pos))
1107+
if (have_duplicate_entry(oid->hash, 0, &index_pos))
11081108
return 0;
11091109

1110-
if (!want_object_in_pack(sha1, 0, &pack, &offset))
1110+
if (!want_object_in_pack(oid->hash, 0, &pack, &offset))
11111111
return 0;
11121112

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);
11141114

11151115
display_progress(progress_state, nr_result);
11161116
return 1;

builtin/rev-list.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,14 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
258258
}
259259

260260
static int show_object_fast(
261-
const unsigned char *sha1,
261+
const struct object_id *oid,
262262
enum object_type type,
263263
int exclude,
264264
uint32_t name_hash,
265265
struct packed_git *found_pack,
266266
off_t found_offset)
267267
{
268-
fprintf(stdout, "%s\n", sha1_to_hex(sha1));
268+
fprintf(stdout, "%s\n", oid_to_hex(oid));
269269
return 1;
270270
}
271271

pack-bitmap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static void show_extended_objects(struct bitmap *objects,
587587
continue;
588588

589589
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);
591591
}
592592
}
593593

@@ -612,7 +612,7 @@ static void show_objects_for_type(
612612
eword_t word = objects->words[i] & filter;
613613

614614
for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
615-
const unsigned char *sha1;
615+
struct object_id oid;
616616
struct revindex_entry *entry;
617617
uint32_t hash = 0;
618618

@@ -625,12 +625,12 @@ static void show_objects_for_type(
625625
continue;
626626

627627
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);
629629

630630
if (bitmap_git.hashes)
631631
hash = get_be32(bitmap_git.hashes + entry->nr);
632632

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);
634634
}
635635

636636
pos += BITS_IN_EWORD;

pack-bitmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ enum pack_bitmap_flags {
2727
};
2828

2929
typedef int (*show_reachable_fn)(
30-
const unsigned char *sha1,
30+
const struct object_id *oid,
3131
enum object_type type,
3232
int flags,
3333
uint32_t hash,

0 commit comments

Comments
 (0)