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 <peff@peff.net> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e704fc7978
commit
ff483026a9
@ -2569,6 +2569,11 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
|
|||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int obj_is_packed(const struct object_id *oid)
|
||||||
|
{
|
||||||
|
return !!packlist_find(&to_pack, oid, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void add_tag_chain(const struct object_id *oid)
|
static void add_tag_chain(const struct object_id *oid)
|
||||||
{
|
{
|
||||||
struct tag *tag;
|
struct tag *tag;
|
||||||
@ -2580,7 +2585,7 @@ static void add_tag_chain(const struct object_id *oid)
|
|||||||
* it was included via bitmaps, we would not have parsed it
|
* it was included via bitmaps, we would not have parsed it
|
||||||
* previously).
|
* previously).
|
||||||
*/
|
*/
|
||||||
if (packlist_find(&to_pack, oid, NULL))
|
if (obj_is_packed(oid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tag = lookup_tag(the_repository, oid);
|
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,
|
|||||||
|
|
||||||
if (starts_with(path, "refs/tags/") && /* is a tag? */
|
if (starts_with(path, "refs/tags/") && /* is a tag? */
|
||||||
!peel_ref(path, &peeled) && /* peelable? */
|
!peel_ref(path, &peeled) && /* peelable? */
|
||||||
packlist_find(&to_pack, &peeled, NULL)) /* object packed? */
|
obj_is_packed(&peeled)) /* object packed? */
|
||||||
add_tag_chain(oid);
|
add_tag_chain(oid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user