diff --git a/builtin/branch.c b/builtin/branch.c
index f7da69c932a6e75f4fc37f063719a08f730f9974..f49596f826228e22d354194ddbb73ec100d8728e 100644 (file)
--- a/builtin/branch.c
+++ b/builtin/branch.c
die(_("Invalid branch name: '%s'"), oldname);
}
- if (strbuf_check_branch_ref(&newref, newname))
- die(_("Invalid branch name: '%s'"), newname);
-
- if (resolve_ref(newref.buf, sha1, 1, NULL) && !force)
- die(_("A branch named '%s' already exists."), newref.buf + 11);
+ validate_new_branchname(newname, &newref, force, 0);
strbuf_addf(&logmsg, "Branch: renamed %s to %s",
oldref.buf, newref.buf);