]> git.ipfire.org Git - thirdparty/git.git/commit - merge-ort.c
merge-ort: add some high-level algorithm structure
authorElijah Newren <newren@gmail.com>
Sun, 13 Dec 2020 08:04:09 +0000 (08:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 13 Dec 2020 22:18:19 +0000 (14:18 -0800)
commit231e2dd49d11c1ea5d19956920651bd3a90ccfce
treede963e5d6bc47fe202fc3d78fc52db69e4e6cb89
parent5b59c3db059d85306ebeb680c4d322a69ee29fde
merge-ort: add some high-level algorithm structure

merge_ort_nonrecursive_internal() will be used by both
merge_inmemory_nonrecursive() and merge_inmemory_recursive(); let's
focus on it for now.  It involves some setup -- merge_start() --
followed by the following chain of functions:

  collect_merge_info()
    This function will populate merge_options_internal's paths field,
    via a call to traverse_trees() and a new callback that will be added
    later.

  detect_and_process_renames()
    This function will detect renames, and then adjust entries in paths
    to move conflict stages from old pathnames into those for new
    pathnames, so that the next step doesn't have to think about renames
    and just can do three-way content merging and such.

  process_entries()
    This function determines how to take the various stages (versions of
    a file from the three different sides) and merge them, and whether
    to mark the result as conflicted or cleanly merged.  It also writes
    out these merged file versions as it goes to create a tree.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-ort.c