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
This commit is contained in:
commit
08986dec70
2
strbuf.c
2
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user