aboutsummaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-08-28 21:19:31 -0700
committerJunio C Hamano <gitster@pobox.com>2011-08-28 21:19:31 -0700
commit1da6d98a9acd2db3902bf432a097771c76f4fd44 (patch)
treecccdbb4533c6998fbba362569906f24c9f4a87cc /builtin/checkout.c
parent67c116bb26b4ee31889e5ee15d6a9d3b7e972b7b (diff)
parent587a9ee7da348f5e6696720d770d0e0da597827c (diff)
downloadgit-1da6d98a9acd2db3902bf432a097771c76f4fd44.tar.gz
git-1da6d98a9acd2db3902bf432a097771c76f4fd44.tar.xz
Merge branch 'ci/forbid-unwanted-current-branch-update'
* ci/forbid-unwanted-current-branch-update: Show interpreted branch name in error messages Prevent force-updating of the current branch
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 4eaedff0c..3bb652591 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1072,15 +1072,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
if (opts.new_branch) {
struct strbuf buf = STRBUF_INIT;
- if (strbuf_check_branch_ref(&buf, opts.new_branch))
- die(_("git checkout: we do not like '%s' as a branch name."),
- opts.new_branch);
- if (ref_exists(buf.buf)) {
- opts.branch_exists = 1;
- if (!opts.new_branch_force)
- die(_("git checkout: branch %s already exists"),
- opts.new_branch);
- }
+
+ opts.branch_exists = validate_new_branchname(opts.new_branch, &buf, !!opts.new_branch_force);
+
strbuf_release(&buf);
}