summaryrefslogtreecommitdiffstats
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-05-11 20:34:16 +0200
committerJunio C Hamano <gitster@pobox.com>2012-05-11 20:34:17 +0200
commita735b79c6357ad5ccc202c29d31b561ad14c75b0 (patch)
tree450f62d4aa0bf703d2ab564c82c0325650898dcf /builtin/checkout.c
parentMerge branch 'jk/maint-reflog-walk-count-vs-time' (diff)
parentcheckout: do not corrupt HEAD on empty repo (diff)
downloadgit-a735b79c6357ad5ccc202c29d31b561ad14c75b0.tar.xz
git-a735b79c6357ad5ccc202c29d31b561ad14c75b0.zip
Merge branch 'ef/checkout-empty'
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/checkout.c')
-rw-r--r--builtin/checkout.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index c93efe4d98..3ddda34f7a 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1092,7 +1092,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;