Merge branch 'jk/maint-commit-document-editmsg' into maint
[gitweb.git] / builtin / checkout.c
index e8c1b1f189f077529ef2a79accb46ef21a9b8fe7..3980d5d06ea5aba4f4d6d30089307fe76c8adff9 100644 (file)
@@ -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);