]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/checkout.c
branch: split validate_new_branchname() into two
[thirdparty/git.git] / builtin / checkout.c
index fc4f8fd2ea29c7c23d3b1c7ca0ba78824c255a91..697ac7dcaf475d5215747743d4bfbc12d7dc518a 100644 (file)
@@ -1289,11 +1289,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);
        }