diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-05-14 11:42:49 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-05-14 11:42:50 -0700 |
commit | 3734dbc4abce39c20530e36c2d47d3269ac0e6cd (patch) | |
tree | abe8461ee17211ec971a57831d118288e260f691 /builtin | |
parent | ea8c6761e3605d18a438efea37660fd7a8ad0ce6 (diff) | |
parent | 8338f771fe9720766dfcb25b6dca58832e24a0fd (diff) | |
download | git-3734dbc4abce39c20530e36c2d47d3269ac0e6cd.tar.gz git-3734dbc4abce39c20530e36c2d47d3269ac0e6cd.tar.xz |
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
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/checkout.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index 160f678b8..c3647934c 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -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; |