diff --git a/builtin-checkout.c b/builtin-checkout.c
index b5dd9c07b42e0130384259715730f52bc8c4e6c3..f32b14838d718907b105bcefd4e015f31aed1403 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 merge_options o;
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 */