Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'jc/checkout-out-of-unborn'
author
Junio C Hamano
<gitster@pobox.com>
Mon, 13 Feb 2012 06:43:44 +0000
(22:43 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 13 Feb 2012 06:43:45 +0000
(22:43 -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:
b95ffc1
abe1998
)
diff --cc
builtin/checkout.c
index 5bf96ba4d41cc9c16bb5ccabe9857724ecfe2c12,b76e2c0451cbeb73e1fd227c343413b1c8a33cc7..6b9061f26f5f33ae1ded811891e933441c210fb0
---
1
/
builtin/checkout.c
---
2
/
builtin/checkout.c
+++ b/
builtin/checkout.c
@@@
-1079,5
-1100,13
+1090,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);
}