merge-ort: implement apply_directory_rename_modifications()
authorElijah Newren <newren@gmail.com>
Tue, 19 Jan 2021 19:53:51 +0000 (19:53 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Jan 2021 06:18:55 +0000 (22:18 -0800)
commit089d82bc18514d78513a85e95de257f74da18205
tree098186f0a727f7d51a42a6a34a3872f7d1e945d3
parent05b85c6eeb1710ff83f11f71abefa2064e50e61b
merge-ort: implement apply_directory_rename_modifications()

This function roughly follows the same outline as the function of the
same name from merge-recursive.c, but the code diverges in multiple
ways due to some special considerations:
  * merge-ort's version needs to update opt->priv->paths with any new
    paths (and opt->priv->paths points to struct conflict_infos which
    track quite a bit of metadata for each path); merge-recursive's
    version would directly update the index
  * merge-ort requires that opt->priv->paths has any leading directories
    of any relevant files also be included in the set of paths.  And
    due to pointer equality requirements on merged_info.directory_name,
    we have to be careful how we compute and insert these.
  * due to the above requirements on opt->priv->paths, merge-ort's
    version starts with a long comment to explain all the special
    considerations that need to be handled
  * merge-ort can use the full data stored in opt->priv->paths to avoid
    making expensive get_tree_entry() calls to regather the necessary
    data.
  * due to messages being deferred automatically in merge-ort, this is
    the best place to handle conflict messages whereas in
    merge-recursive.c they are deferred manually so that processing of
    entries does all the printing

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