summaryrefslogtreecommitdiff
path: root/merge-recursive.h
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2019-08-17 18:41:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-08-19 17:08:03 (GMT)
commit98a1d3d88895a1cbc01b88627776bb4e2bfd6b84 (patch)
tree11bef202a5847f892ccc164f104becf19e24082f /merge-recursive.h
parent9822175d2b349be1ed7a704d3a56dc912f5a7510 (diff)
downloadgit-98a1d3d88895a1cbc01b88627776bb4e2bfd6b84.zip
git-98a1d3d88895a1cbc01b88627776bb4e2bfd6b84.tar.gz
git-98a1d3d88895a1cbc01b88627776bb4e2bfd6b84.tar.bz2
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 'merge-recursive.h')
0 files changed, 0 insertions, 0 deletions