Be careful when dereferencing tags.
One caller of deref_tag() was not careful enough to make sure what deref_tag() returned was not NULL (i.e. we found a tag object that points at an object we do not have). Fix it, and warn about refs that point at such an incomplete tag where needed. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
7
tag.c
7
tag.c
@ -3,10 +3,15 @@
|
||||
|
||||
const char *tag_type = "tag";
|
||||
|
||||
struct object *deref_tag(struct object *o)
|
||||
struct object *deref_tag(struct object *o, const char *warn, int warnlen)
|
||||
{
|
||||
while (o && o->type == tag_type)
|
||||
o = parse_object(((struct tag *)o)->tagged->sha1);
|
||||
if (!o && warn) {
|
||||
if (!warnlen)
|
||||
warnlen = strlen(warn);
|
||||
error("missing object referenced by '%.*s'", warnlen, warn);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user