Git fork

merge-ort: allow rename detection to be disabled

When merge-ort was written, I did not at first allow rename detection to
be disabled, because I suspected that most folks disabling rename
detection were doing so solely for performance reasons. Since I put a
lot of working into providing dramatic speedups for rename detection
performance as used by the merge machinery, I wanted to know if there
were still real world repositories where rename detection was
problematic from a performance perspective. We have had years now to
collect such information, and while we never received one, waiting
longer with the option disabled seems unlikely to help surface such
issues at this point. Also, there has been at least one request to
allow rename detection to be disabled for behavioral rather than
performance reasons (see the thread including
https://lore.kernel.org/git/CABPp-BG-Nx6SCxxkGXn_Fwd2wseifMFND8eddvWxiZVZk0zRaA@mail.gmail.com/
), so let's start heeding the config and command line settings.

Signed-off-by: Elijah Newren <newren@gmail.com>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Elijah Newren and committed by
Junio C Hamano
a707d4f9 4e5d9de9

+17 -6
+6 -6
Documentation/merge-strategies.adoc
··· 82 82 rename-threshold=<n>;; 83 83 Deprecated synonym for `find-renames=<n>`. 84 84 85 + no-renames;; 86 + Turn off rename detection. This overrides the `merge.renames` 87 + configuration variable. 88 + See also linkgit:git-diff[1] `--no-renames`. 89 + 85 90 subtree[=<path>];; 86 91 This option is a more advanced form of 'subtree' strategy, where 87 92 the strategy makes a guess on how two trees must be shifted to ··· 107 112 strategy. 108 113 + 109 114 The 'recursive' strategy takes the same options as 'ort'. However, 110 - there are three additional options that 'ort' ignores (not documented 115 + there are two additional options that 'ort' ignores (not documented 111 116 above) that are potentially useful with the 'recursive' strategy: 112 117 113 118 patience;; ··· 120 125 linkgit:git-diff[1] `--diff-algorithm`. Note that `ort` 121 126 specifically uses `diff-algorithm=histogram`, while `recursive` 122 127 defaults to the `diff.algorithm` config setting. 123 - 124 - no-renames;; 125 - Turn off rename detection. This overrides the `merge.renames` 126 - configuration variable. 127 - See also linkgit:git-diff[1] `--no-renames`. 128 128 129 129 resolve:: 130 130 This can only resolve two heads (i.e. the current branch
+5
merge-ort.c
··· 3448 3448 3449 3449 if (!possible_renames(renames)) 3450 3450 goto cleanup; 3451 + if (!opt->detect_renames) { 3452 + renames->redo_after_renames = 0; 3453 + renames->cached_pairs_valid_side = 0; 3454 + goto cleanup; 3455 + } 3451 3456 3452 3457 trace2_region_enter("merge", "regular renames", opt->repo); 3453 3458 detection_run |= detect_regular_renames(opt, MERGE_SIDE1);
+6
t/t4301-merge-tree-write-tree.sh
··· 73 73 test_cmp expect actual 74 74 ' 75 75 76 + # Repeat the previous test, but turn off rename detection 77 + test_expect_success 'Failed merge without rename detection' ' 78 + test_must_fail git -c diff.renames=false merge-tree --write-tree side1 side3 >out && 79 + grep "CONFLICT (modify/delete): numbers deleted" out 80 + ' 81 + 76 82 test_expect_success 'Content merge and a few conflicts' ' 77 83 git checkout side1^0 && 78 84 test_must_fail git merge side2 &&