diff options
author | Elijah Newren <newren@gmail.com> | 2019-08-17 11:41:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-08-19 10:08:03 -0700 |
commit | 98a1d3d88895a1cbc01b88627776bb4e2bfd6b84 (patch) | |
tree | 11bef202a5847f892ccc164f104becf19e24082f /builtin/verify-commit.c | |
parent | Ensure index matches head before invoking merge machinery, round N (diff) | |
download | tgif-98a1d3d88895a1cbc01b88627776bb4e2bfd6b84.tar.xz |
merge-recursive: exit early if index != head
We had a rule to enforce that the index matches head, but it was found
at the beginning of merge_trees() and would only trigger when
opt->call_depth was 0. Since merge_recursive() doesn't call
merge_trees() until after returning from recursing, this meant that the
check wasn't triggered by merge_recursive() until it had first finished
all the intermediate merges to create virtual merge bases. That is a
potentially huge amount of computation (and writing of intermediate
merge results into the .git/objects directory) before it errors out and
says, in effect, "Sorry, I can't do any merging because you have some
local changes that would be overwritten."
Further, not enforcing this requirement earlier allowed other bugs (such
as an unintentional unconditional dropping and reloading of the index in
merge_recursive() even when no recursion was necessary), to mask bugs in
other callers (which were fixed in the commit prior to this one).
Make sure we do the index == head check at the beginning of the merge,
and error out immediately if it fails. While we're at it, fix a small
leak in the show-the-error codepath.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/verify-commit.c')
0 files changed, 0 insertions, 0 deletions