Skip to content

Commit

Permalink
Merge branch 'jc/no-branch-name-with-dash-at-front'
Browse files Browse the repository at this point in the history
* jc/no-branch-name-with-dash-at-front:
  disallow branch names that start with a hyphen
  • Loading branch information
Junio C Hamano committed Sep 29, 2010
2 parents 0ff4bdb + 6348624 commit 08986de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions strbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 08986de

Please sign in to comment.