aboutsummaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-09 09:02:00 -0700
committerJunio C Hamano <gitster@pobox.com>2012-07-09 09:02:00 -0700
commit45c96c0c8264975519c595afa37136c488f7017a (patch)
treeea8ca5666e267caed04623876fca75f7c1c1e4e2 /builtin/checkout.c
parent967abba7169ad10eff841fe32b70f3e7a1126b63 (diff)
parent8ced1aa08f9e1798b2b3fec41a0598ef79b477fe (diff)
downloadgit-45c96c0c8264975519c595afa37136c488f7017a.tar.gz
git-45c96c0c8264975519c595afa37136c488f7017a.tar.xz
Merge branch 'cw/no-detaching-an-unborn'
"git checkout --detach", when you are still on an unborn branch, should be forbidden, but it wasn't. * cw/no-detaching-an-unborn: git-checkout: disallow --detach on unborn branch
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index e8c1b1f18..3980d5d06 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -915,6 +915,8 @@ static int switch_unborn_to_new_branch(struct checkout_opts *opts)
int status;
struct strbuf branch_ref = STRBUF_INIT;
+ if (!opts->new_branch)
+ die(_("You are on a branch yet to be born"));
strbuf_addf(&branch_ref, "refs/heads/%s", opts->new_branch);
status = create_symref("HEAD", branch_ref.buf, "checkout -b");
strbuf_release(&branch_ref);