X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin-checkout.c;h=2708669383e21f038a1404e061b34bc4302e8a93;hb=e07fd15b1295393ddf954b9fdd0c3a961e5509c5;hp=64f3a11ae1d415c466def8eccefe9dbc5b6b3926;hpb=61b8f407a766bf10ec466e66ec606902a171fc85;p=git.git diff --git a/builtin-checkout.c b/builtin-checkout.c index 64f3a11ae..270866938 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -397,7 +397,7 @@ static int merge_working_tree(struct checkout_opts *opts, 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)); @@ -422,7 +422,13 @@ static int merge_working_tree(struct checkout_opts *opts, 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 */