diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-11-28 13:41:49 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-11-28 13:41:49 +0900 |
commit | 16169285f1e63f6a3d9ec10e48f55d6825d3156b (patch) | |
tree | ddcde546556a9bd2a5d4cce6daca273edc30963c /builtin/checkout.c | |
parent | 5f9953d2c365bffed6f9ee0c6966556bd4d7e2f4 (diff) | |
parent | 662a4c8a097248a3c08a671866ecf37743f3ca4d (diff) | |
download | git-16169285f1e63f6a3d9ec10e48f55d6825d3156b.tar.gz git-16169285f1e63f6a3d9ec10e48f55d6825d3156b.tar.xz |
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()
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r-- | builtin/checkout.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 7d8bcc383..3faae382d 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -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); } |