Skip to content

Commit c09376d

Browse files
newrengitster
authored andcommitted
merge-ort: add new data structures for directory rename detection
Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8f894b2 commit c09376d

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

merge-ort.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,42 @@ enum merge_side {
4949
};
5050

5151
struct rename_info {
52+
/*
53+
* All variables that are arrays of size 3 correspond to data tracked
54+
* for the sides in enum merge_side. Index 0 is almost always unused
55+
* because we often only need to track information for MERGE_SIDE1 and
56+
* MERGE_SIDE2 (MERGE_BASE can't have rename information since renames
57+
* are determined relative to what changed since the MERGE_BASE).
58+
*/
59+
5260
/*
5361
* pairs: pairing of filenames from diffcore_rename()
54-
*
55-
* Index 1 and 2 correspond to sides 1 & 2 as used in
56-
* conflict_info.stages. Index 0 unused.
5762
*/
5863
struct diff_queue_struct pairs[3];
5964

65+
/*
66+
* dirs_removed: directories removed on a given side of history.
67+
*/
68+
struct strset dirs_removed[3];
69+
70+
/*
71+
* dir_rename_count: tracking where parts of a directory were renamed to
72+
*
73+
* When files in a directory are renamed, they may not all go to the
74+
* same location. Each strmap here tracks:
75+
* old_dir => {new_dir => int}
76+
* That is, dir_rename_count[side] is a strmap to a strintmap.
77+
*/
78+
struct strmap dir_rename_count[3];
79+
80+
/*
81+
* dir_renames: computed directory renames
82+
*
83+
* This is a map of old_dir => new_dir and is derived in part from
84+
* dir_rename_count.
85+
*/
86+
struct strmap dir_renames[3];
87+
6088
/*
6189
* needed_limit: value needed for inexact rename detection to run
6290
*

0 commit comments

Comments
 (0)