merge-ort: add new data structures for directory rename detection
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Jan 7, 2021 at 21:35 UTC
c09376d55ff41128f3966609e1c4edf3e9fee840
1 file changed
+31
-3
merge-ort.c
+31
-3
@@ -49,14 +49,42 @@ enum merge_side {
49
};
50
51
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
+
60
/*
61
* 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.
62
*/
63
struct diff_queue_struct pairs[3];
64
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
+
88
/*
89
* needed_limit: value needed for inexact rename detection to run
90
*