diff options
author | Elijah Newren <newren@gmail.com> | 2022-01-17 19:25:55 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-17 23:24:22 +0100 |
commit | 9ae39fef7f3764537e029b57687f6a0a3163e810 (patch) | |
tree | e3ecedb4dc21517b49d794f4804a70e3fe6e78d5 /merge-ort.c | |
parent | Merge branch 'vd/pthread-setspecific-g11-fix' into maint (diff) | |
download | git-9ae39fef7f3764537e029b57687f6a0a3163e810.tar.xz git-9ae39fef7f3764537e029b57687f6a0a3163e810.zip |
merge-ort: avoid assuming all renames detected
In commit 8b09a900a1 ("merge-ort: restart merge with cached renames to
reduce process entry cost", 2021-07-16), we noted that in the merge-ort
steps of
collect_merge_info()
detect_and_process_renames()
process_entries()
that process_entries() was expensive, and we could often make it cheaper
by changing this to
collect_merge_info()
detect_and_process_renames()
<cache all the renames, and restart>
collect_merge_info()
detect_and_process_renames()
process_entries()
because the second collect_merge_info() would be cheaper (we could avoid
traversing into some directories), the second
detect_and_process_renames() would be free since we had already detected
all renames, and then process_entries() has far fewer entries to handle.
However, this was built on the assumption that the first
detect_and_process_renames() actually detected all potential renames.
If someone has merge.renameLimit set to some small value, that
assumption is violated which manifests later with the following message:
$ git -c merge.renameLimit=1 rebase upstream
...
git: merge-ort.c:546: clear_or_reinit_internal_opts: Assertion
`renames->cached_pairs_valid_side == 0' failed.
Turn off this cache-renames-and-restart whenever we cannot detect all
renames, and add a testcase that would have caught this problem.
Reported-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Tested-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r-- | merge-ort.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/merge-ort.c b/merge-ort.c index b346e23ff2..7b2c0e9ee2 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -3031,6 +3031,10 @@ static int detect_and_process_renames(struct merge_options *opt, trace2_region_enter("merge", "regular renames", opt->repo); detection_run |= detect_regular_renames(opt, MERGE_SIDE1); detection_run |= detect_regular_renames(opt, MERGE_SIDE2); + if (renames->needed_limit) { + renames->cached_pairs_valid_side = 0; + renames->redo_after_renames = 0; + } if (renames->redo_after_renames && detection_run) { int i, side; struct diff_filepair *p; |