Merge branch 'ef/checkout-empty' into maint

Running "git checkout" on an unborn branch used to corrupt HEAD
(regression in 1.7.10); this makes it error out.

By Erik Faye-Lund
* ef/checkout-empty:
  checkout: do not corrupt HEAD on empty repo
This commit is contained in:
Junio C Hamano
2012-05-14 11:42:49 -07:00
2 changed files with 12 additions and 1 deletions

View File

@ -1091,7 +1091,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
if (opts.writeout_stage)
die(_("--ours/--theirs is incompatible with switching branches."));
if (!new.commit) {
if (!new.commit && opts.new_branch) {
unsigned char rev[20];
int flag;