Merge branch 'jc/branch-name-sanity'
"git branch" and "git checkout -b" are now forbidden from creating
a branch whose name is "HEAD".
* jc/branch-name-sanity:
builtin/branch: remove redundant check for HEAD
branch: correctly reject refs/heads/{-dash,HEAD}
branch: split validate_new_branchname() into two
branch: streamline "attr_only" handling in validate_new_branchname()
This commit is contained in:
@ -1287,11 +1287,11 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
|
||||
if (opts.new_branch) {
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
|
||||
opts.branch_exists =
|
||||
validate_new_branchname(opts.new_branch, &buf,
|
||||
!!opts.new_branch_force,
|
||||
!!opts.new_branch_force);
|
||||
|
||||
if (opts.new_branch_force)
|
||||
opts.branch_exists = validate_branchname(opts.new_branch, &buf);
|
||||
else
|
||||
opts.branch_exists =
|
||||
validate_new_branchname(opts.new_branch, &buf, 0);
|
||||
strbuf_release(&buf);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user