summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6e8f993)
raw | patch | inline | side by side (parent: 6e8f993)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 7 Jan 2010 07:51:47 +0000 (23:51 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 7 Jan 2010 07:51:47 +0000 (23:51 -0800) |
If switching from an unborn branch (= empty tree) to a valid commit failed
without -m, it would fail with -m option as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
without -m, it would fail with -m option as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-checkout.c | patch | blob | history |
diff --git a/builtin-checkout.c b/builtin-checkout.c
index c107fd643a452edb016f7ad867d4b2a555d9abaf..b76cd22776299955d1ff876b5668f2336b4321a2 100644 (file)
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
topts.initial_checkout = is_cache_unborn();
topts.update = 1;
topts.merge = 1;
- topts.gently = opts->merge;
+ topts.gently = opts->merge && old->commit;
topts.verbose_update = !opts->quiet;
topts.fn = twoway_merge;
topts.dir = xcalloc(1, sizeof(*topts.dir));
struct tree *work;
if (!opts->merge)
return 1;
- parse_commit(old->commit);
+
+ /*
+ * Without old->commit, the below is the same as
+ * the two-tree unpack we already tried and failed.
+ */
+ if (!old->commit)
+ return 1;
/* Do more real merge */