* jc/checkout-out-of-unborn:
git checkout -b: allow switching out of an unborn branch
if (opts.writeout_stage)
die(_("--ours/--theirs is incompatible with switching branches."));
- resolve_ref("HEAD", rev, 0, &flag);
- if ((flag & REF_ISSYMREF) && is_null_sha1(rev))
+ if (!new.commit) {
+ unsigned char rev[20];
+ int flag;
+
++ if (!read_ref_full("HEAD", rev, 0, &flag) &&
++ (flag & REF_ISSYMREF) && is_null_sha1(rev))
+ return switch_unborn_to_new_branch(&opts);
+ }
return switch_branches(&opts, &new);
}