Instead, you could write something like:

```c
static int enqueue_tag(git_object **out, git_push *push, git_oid *id)
{
	int error;
	git_object *tag = NULL;

	if ((error = git_object_lookup(&tag, push->repo, id)) < 0)
		return error;

	while (git_object_type(tag) == GIT_OBJ_TAG &&
		!(error = git_packbuilder_insert(push->pb, git_object_id(tag), NULL)))
	{
		git_object *tgt = NULL;
		if ((error = git_tag_target(&tgt, push->repo, (git_tag *)tag)) < 0)
			break;
		git_object_free(tag);
		tag = tgt;
	}

	git_object_free(tag);
	return error;
}
```

Haven't actually tested with that, but it was just an experiment...