Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'jc/checkout-out-of-unborn' into maint
author
Junio C Hamano
<gitster@pobox.com>
Thu, 16 Feb 2012 22:18:06 +0000
(14:18 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 16 Feb 2012 22:18:06 +0000
(14:18 -0800)
* jc/checkout-out-of-unborn:
git checkout -b: allow switching out of an unborn branch
1
2
builtin/checkout.c
patch
|
diff1
|
diff2
|
blob
|
history
raw
|
combined
(merge:
57d6b07
abe1998
)
diff --cc
builtin/checkout.c
index f1984d9933c526bcd2af66fd745dc64a607ac19b,b76e2c0451cbeb73e1fd227c343413b1c8a33cc7..a76aa2a6fd6ad076f4d10e4f5227d24b31c063ca
---
1
/
builtin/checkout.c
---
2
/
builtin/checkout.c
+++ b/
builtin/checkout.c
@@@
-1093,5
-1100,13
+1104,13
@@@
int cmd_checkout(int argc, const char *
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);
}