diff options
author | Christian Couder <christian.couder@gmail.com> | 2024-02-28 09:10:11 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-28 17:28:18 (GMT) |
commit | a4324babe679352a801310f8e30f3cbcd9c1f16b (patch) | |
tree | 5c392df0c0a7c561d17ebda727d1ab35e67673b0 /revision.c | |
parent | 7b644c8c5a67cdda4a15ac91976eb29f5e29b796 (diff) | |
download | git-a4324babe679352a801310f8e30f3cbcd9c1f16b.zip git-a4324babe679352a801310f8e30f3cbcd9c1f16b.tar.gz git-a4324babe679352a801310f8e30f3cbcd9c1f16b.tar.bz2 |
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>
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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; |