Skip to content

Commit 3d45483

Browse files
pks-tgitster
authored andcommitted
pack-bitmap: allow passing payloads to show_reachable_fn()
The `show_reachable_fn` callback is used by a couple of functions to present reachable objects to the caller. The function does not provide a way for the caller to pass a payload though, which is functionality that we'll require in a subsequent commit. Change the callback type to accept a payload and adapt all callsites accordingly. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8fa9fe1 commit 3d45483

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

builtin/pack-objects.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,8 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
17361736
static int add_object_entry_from_bitmap(const struct object_id *oid,
17371737
enum object_type type,
17381738
int flags UNUSED, uint32_t name_hash,
1739-
struct packed_git *pack, off_t offset)
1739+
struct packed_git *pack, off_t offset,
1740+
void *payload UNUSED)
17401741
{
17411742
display_progress(progress_state, ++nr_seen);
17421743

builtin/rev-list.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ static int show_object_fast(
429429
int exclude UNUSED,
430430
uint32_t name_hash UNUSED,
431431
struct packed_git *found_pack UNUSED,
432-
off_t found_offset UNUSED)
432+
off_t found_offset UNUSED,
433+
void *payload UNUSED)
433434
{
434435
fprintf(stdout, "%s\n", oid_to_hex(oid));
435436
return 1;

pack-bitmap.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ static void show_extended_objects(struct bitmap_index *bitmap_git,
16251625
(obj->type == OBJ_TAG && !revs->tag_objects))
16261626
continue;
16271627

1628-
show_reach(&obj->oid, obj->type, 0, eindex->hashes[i], NULL, 0);
1628+
show_reach(&obj->oid, obj->type, 0, eindex->hashes[i], NULL, 0, NULL);
16291629
}
16301630
}
16311631

@@ -1663,7 +1663,8 @@ static void init_type_iterator(struct ewah_or_iterator *it,
16631663
static void show_objects_for_type(
16641664
struct bitmap_index *bitmap_git,
16651665
enum object_type object_type,
1666-
show_reachable_fn show_reach)
1666+
show_reachable_fn show_reach,
1667+
void *payload)
16671668
{
16681669
size_t i = 0;
16691670
uint32_t offset;
@@ -1715,7 +1716,7 @@ static void show_objects_for_type(
17151716
if (bitmap_git->hashes)
17161717
hash = get_be32(bitmap_git->hashes + index_pos);
17171718

1718-
show_reach(&oid, object_type, 0, hash, pack, ofs);
1719+
show_reach(&oid, object_type, 0, hash, pack, ofs, payload);
17191720
}
17201721
}
17211722

@@ -2518,13 +2519,13 @@ void traverse_bitmap_commit_list(struct bitmap_index *bitmap_git,
25182519
{
25192520
assert(bitmap_git->result);
25202521

2521-
show_objects_for_type(bitmap_git, OBJ_COMMIT, show_reachable);
2522+
show_objects_for_type(bitmap_git, OBJ_COMMIT, show_reachable, NULL);
25222523
if (revs->tree_objects)
2523-
show_objects_for_type(bitmap_git, OBJ_TREE, show_reachable);
2524+
show_objects_for_type(bitmap_git, OBJ_TREE, show_reachable, NULL);
25242525
if (revs->blob_objects)
2525-
show_objects_for_type(bitmap_git, OBJ_BLOB, show_reachable);
2526+
show_objects_for_type(bitmap_git, OBJ_BLOB, show_reachable, NULL);
25262527
if (revs->tag_objects)
2527-
show_objects_for_type(bitmap_git, OBJ_TAG, show_reachable);
2528+
show_objects_for_type(bitmap_git, OBJ_TAG, show_reachable, NULL);
25282529

25292530
show_extended_objects(bitmap_git, revs, show_reachable);
25302531
}

pack-bitmap.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ typedef int (*show_reachable_fn)(
5050
int flags,
5151
uint32_t hash,
5252
struct packed_git *found_pack,
53-
off_t found_offset);
53+
off_t found_offset,
54+
void *payload);
5455

5556
struct bitmap_index;
5657

reachable.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ static int mark_object_seen(const struct object_id *oid,
341341
int exclude UNUSED,
342342
uint32_t name_hash UNUSED,
343343
struct packed_git *found_pack UNUSED,
344-
off_t found_offset UNUSED)
344+
off_t found_offset UNUSED,
345+
void *payload UNUSED)
345346
{
346347
struct object *obj = lookup_object_by_type(the_repository, oid, type);
347348
if (!obj)

0 commit comments

Comments
 (0)