summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2018-07-13 00:03:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-16 19:56:14 (GMT)
commitdc0a13f6813f35bae5fd2de6af4d5524a20d5b82 (patch)
tree6b78e5172d41cb0363e323e5f72c170f7d3bdc97 /revision.c
parenta7e67c11b8b983b4a9f56f0b8990a550946ed6b0 (diff)
downloadgit-dc0a13f6813f35bae5fd2de6af4d5524a20d5b82.zip
git-dc0a13f6813f35bae5fd2de6af4d5524a20d5b82.tar.gz
git-dc0a13f6813f35bae5fd2de6af4d5524a20d5b82.tar.bz2
revision: tolerate promised targets of tags
In handle_commit(), it is fatal for an annotated tag to point to a non-existent object. --exclude-promisor-objects should relax this rule and allow non-existent objects that are promisor objects, but this is not the case. Update handle_commit() to tolerate this situation. This was observed when cloning from a repository with an annotated tag pointing to a blob. The test included in this patch demonstrates this case. Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index 1b37da9..95546e6 100644
--- a/revision.c
+++ b/revision.c
@@ -248,6 +248,9 @@ static struct commit *handle_commit(struct rev_info *revs,
if (!object) {
if (revs->ignore_missing_links || (flags & UNINTERESTING))
return NULL;
+ if (revs->exclude_promisor_objects &&
+ is_promisor_object(&tag->tagged->oid))
+ return NULL;
die("bad object %s", oid_to_hex(&tag->tagged->oid));
}
object->flags |= flags;