Junio C Hamano <[email protected]> writes:
>> + if (check_refname_format(buffer, REFNAME_ALLOW_ONELEVEL))
>> + ret = error_func(&tag->object, FSCK_ERROR, "invalid 'tag' name:
>> %s", buffer);
>> + *eol = '\n';
>
> I actually think this check is harmful.
Let me take this one back; we do a moral equivalent when we create a
tag, like this:
strbuf_addf(sb, "refs/tags/%s", name);
return check_refname_format(sb->buf, 0);
So validating using check_refname_format() is indeed a very good
thing to do.
As you have length and buffer here, I would suggest updating this
part of your patch to print into a strbuf
strbuf_addf(&sb, "refs/tags/%.*s", (eol - buffer), buffer);
if (check_refname_format(sb.buf))
ret = ...
and keep the constness of the incoming data.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html