X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=strbuf.c;h=65b4cf43434a8b7327565d0e0f87d5378d098f99;hb=60109d0ef5974b5066b6998fafe1da7187174c88;hp=bc3a0802ea7e7b1743602972de182391b4bf0b3f;hpb=4e7d08a229a531f8d7841a8a1a892d5989130d67;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); }