X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=strbuf.c;h=65b4cf43434a8b7327565d0e0f87d5378d098f99;hb=b3f01ff29f7131e959bcfdfd004744d74d5fa319;hp=bc3a0802ea7e7b1743602972de182391b4bf0b3f;hpb=e8a12280530f16bf2089999ceefe35794d115d07;p=git.git diff --git a/strbuf.c b/strbuf.c index bc3a0802e..65b4cf434 100644 --- a/strbuf.c +++ b/strbuf.c @@ -399,6 +399,8 @@ int strbuf_branchname(struct strbuf *sb, const char *name) int strbuf_check_branch_ref(struct strbuf *sb, const char *name) { strbuf_branchname(sb, name); + if (name[0] == '-') + return CHECK_REF_FORMAT_ERROR; strbuf_splice(sb, 0, 0, "refs/heads/", 11); return check_ref_format(sb->buf); }