aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-09-29 13:49:38 -0700
committerJunio C Hamano <gitster@pobox.com>2010-09-29 13:49:38 -0700
commit08986dec702f76b50e885944c4cbbda5fcf5a193 (patch)
treed3848c22bfd4abf99ef445e39d86d024f0c7ba3b
parent0ff4bdba32f2f372af8a738ff4e7beefc3c4bfe0 (diff)
parent6348624010888bd2353e5cebdc2b5329490b0f6d (diff)
downloadgit-08986dec702f76b50e885944c4cbbda5fcf5a193.tar.gz
git-08986dec702f76b50e885944c4cbbda5fcf5a193.tar.xz
Merge branch 'jc/no-branch-name-with-dash-at-front'
* jc/no-branch-name-with-dash-at-front: disallow branch names that start with a hyphen
-rw-r--r--strbuf.c2
1 files changed, 2 insertions, 0 deletions
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);
}