Skip to content

Commit ff48302

Browse files
peffgitster
authored andcommitted
builtin/pack-objects: introduce obj_is_packed()
Let's refactor the way we check if an object is packed by introducing obj_is_packed(). This function is now a simple wrapper around packlist_find(), but it will evolve in a following commit. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e704fc7 commit ff48302

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

builtin/pack-objects.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2569,6 +2569,11 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
25692569
free(p);
25702570
}
25712571

2572+
static int obj_is_packed(const struct object_id *oid)
2573+
{
2574+
return !!packlist_find(&to_pack, oid, NULL);
2575+
}
2576+
25722577
static void add_tag_chain(const struct object_id *oid)
25732578
{
25742579
struct tag *tag;
@@ -2580,7 +2585,7 @@ static void add_tag_chain(const struct object_id *oid)
25802585
* it was included via bitmaps, we would not have parsed it
25812586
* previously).
25822587
*/
2583-
if (packlist_find(&to_pack, oid, NULL))
2588+
if (obj_is_packed(oid))
25842589
return;
25852590

25862591
tag = lookup_tag(the_repository, oid);
@@ -2604,7 +2609,7 @@ static int add_ref_tag(const char *path, const struct object_id *oid, int flag,
26042609

26052610
if (starts_with(path, "refs/tags/") && /* is a tag? */
26062611
!peel_ref(path, &peeled) && /* peelable? */
2607-
packlist_find(&to_pack, &peeled, NULL)) /* object packed? */
2612+
obj_is_packed(&peeled)) /* object packed? */
26082613
add_tag_chain(oid);
26092614
return 0;
26102615
}

0 commit comments

Comments
 (0)