Unverified Commit 45f58409 by Edward Thomson Committed by GitHub

Merge pull request #4484 from pks-t/pks/fail-creating-branch-HEAD

branch: refuse creating branches named 'HEAD'
parents 4ea8035d a9677e01
......@@ -70,6 +70,12 @@ static int create_branch(
assert(branch_name && commit && ref_out);
assert(git_object_owner((const git_object *)commit) == repository);
if (!git__strcmp(branch_name, "HEAD")) {
giterr_set(GITERR_REFERENCE, "'HEAD' is not a valid branch name");
error = -1;
goto cleanup;
}
if (force && !bare && git_branch_lookup(&branch, repository, branch_name, GIT_BRANCH_LOCAL) == 0) {
error = git_branch_is_head(branch);
git_reference_free(branch);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment