revision: fix --missing=[print|allow*] for annotated tags
In 9830926c7d (rev-list: add commit object support in `--missing`
option, 2023-10-27) we fixed the `--missing` option in `git rev-list`
so that it works with missing commits, not just blobs/trees.
Unfortunately, such a command was still failing with a "fatal: bad
object <oid>" if it was passed a missing commit, blob or tree as an
argument (before the rev walking even begins). This was fixed in a
recent commit.
That fix still doesn't work when an argument passed to the command is
an annotated tag pointing to a missing commit though. In that case
`git rev-list --missing=...` still errors out with a "fatal: bad
object <oid>" error where <oid> is the object ID of the missing
commit.
Let's fix this issue, and also, while at it, let's add tests not just
for annotated tags but also for regular tags and branches.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
7b644c8c5a
commit
a4324babe6
@ -419,15 +419,21 @@ static struct commit *handle_commit(struct rev_info *revs,
|
||||
*/
|
||||
while (object->type == OBJ_TAG) {
|
||||
struct tag *tag = (struct tag *) object;
|
||||
struct object_id *oid;
|
||||
if (revs->tag_objects && !(flags & UNINTERESTING))
|
||||
add_pending_object(revs, object, tag->tag);
|
||||
object = parse_object(revs->repo, get_tagged_oid(tag));
|
||||
oid = get_tagged_oid(tag);
|
||||
object = parse_object(revs->repo, oid);
|
||||
if (!object) {
|
||||
if (revs->ignore_missing_links || (flags & UNINTERESTING))
|
||||
return NULL;
|
||||
if (revs->exclude_promisor_objects &&
|
||||
is_promisor_object(&tag->tagged->oid))
|
||||
return NULL;
|
||||
if (revs->do_not_die_on_missing_objects && oid) {
|
||||
oidset_insert(&revs->missing_commits, oid);
|
||||
return NULL;
|
||||
}
|
||||
die("bad object %s", oid_to_hex(&tag->tagged->oid));
|
||||
}
|
||||
object->flags |= flags;
|
||||
|
||||
Reference in New Issue
Block a user