mbox series

[00/11] merge-ort: add basic rename detection

Message ID pull.812.git.1607542887.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series merge-ort: add basic rename detection | expand

Message

Linus Arver via GitGitGadget Dec. 9, 2020, 7:41 p.m. UTC
This series builds on en/merge-ort-2 and adds basic rename detection to
merge-ort.

The first five patches set up the basic algorithm structure. Patches 6-10
implement different type of rename-related cases, one-by-one. Patch 11 also
implements a rename-related case, but one that merge-recursive doesn't
really handle.

A couple early patches mimic or even copy from merge-recursive, but in later
patches the implementation here diverges heavily from merge-recursive's.
Patches 6-10 refer to this repeatedly, all having a slight variant of the
following paragraph in their commit messages:

The consolidation of $NUM separate codepaths into one is made possible
by a change in design: process_renames() tweaks the conflict_info
entries within opt->priv->paths such that process_entry() can then
handle all the non-rename conflict types (directory/file, modify/delete,
etc.) orthogonally.  This means we're much less likely to miss special
implementation of some kind of combination of conflict types (see
commits brought in by 66c62eaec6 ("Merge branch 'en/merge-tests'",
2020-11-18), especially commit ef52778708 ("merge tests: expect improved
directory/file conflict handling in ort", 2020-10-26) for more details).
That, together with letting worktree/index updating be handled
orthogonally in the merge_switch_to_result() function, dramatically
simplifies the code for various special rename cases.

This patch series does not make more tests pass under
GIT_TEST_MERGE_ALGORITHM=ort by itself, because once renames are handled
then content merging needs to happen and that code still does a die("Not yet
implemented."). I'll be soon submitting parallel patches for more basic
conflict handling and recursiveness, and when all three series are merged
down (in any order), it will drop the number of test failures under
GIT_TEST_MERGE_ALGORITHM=ort from 1448 to 60.

Elijah Newren (11):
  merge-ort: add basic data structures for handling renames
  merge-ort: add initial outline for basic rename detection
  merge-ort: implement detect_regular_renames()
  merge-ort: implement compare_pairs() and collect_renames()
  merge-ort: add basic outline for process_renames()
  merge-ort: add implementation of both sides renaming identically
  merge-ort: add implementation of both sides renaming differently
  merge-ort: add implementation of rename collisions
  merge-ort: add implementation of rename/delete conflicts
  merge-ort: add implementation of normal rename handling
  merge-ort: add implementation of type-changed rename handling

 merge-ort.c | 439 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 423 insertions(+), 16 deletions(-)


base-commit: 2f73290465428ae9d088819b8a07bc5c4efe4a8b
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-812%2Fnewren%2Fort-renames-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-812/newren/ort-renames-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/812