merge-ort: add outline for computing directory renames
Port some directory rename handling changes from merge-recursive.c's detect_and_process_renames() to the same-named function of merge-ort.c. This does not yet add any use or handling of directory renames, just the outline for where we start to compute them. Thus, a future patch will add port additional changes to merge-ort's detect_and_process_renames(). Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Jan 19, 2021 at 19:53 UTC
112e11126b963923d84f90f12dae9b96271ccedb
1 file changed
+24
-1
merge-ort.c
+24
-1
@@ -721,6 +721,18 @@ static int handle_content_merge(struct merge_options *opt,
721
722
/*** Function Grouping: functions related to directory rename detection ***/
723
724
+static void get_provisional_directory_renames(struct merge_options *opt,
725
+ unsigned side,
726
+ int *clean)
727
+{
728
+ die("Not yet implemented!");
729
+}
730
+
731
+static void handle_directory_level_conflicts(struct merge_options *opt)
732
+{
733
+ die("Not yet implemented!");
734
+}
735
+
736
/*** Function Grouping: functions related to regular rename detection ***/
737
738
static int process_renames(struct merge_options *opt,
@@ -1086,13 +1098,24 @@ static int detect_and_process_renames(struct merge_options *opt,
1098
{
1099
struct diff_queue_struct combined;
1100
struct rename_info *renames = &opt->priv->renames;
1089
- int s, clean = 1;
1101
+ int need_dir_renames, s, clean = 1;
1102
1103
memset(&combined, 0, sizeof(combined));
1104
1105
detect_regular_renames(opt, merge_base, side1, MERGE_SIDE1);
1106
detect_regular_renames(opt, merge_base, side2, MERGE_SIDE2);
1107
1108
+ need_dir_renames =
1109
+ !opt->priv->call_depth &&
1110
+ (opt->detect_directory_renames == MERGE_DIRECTORY_RENAMES_TRUE ||
1111
+ opt->detect_directory_renames == MERGE_DIRECTORY_RENAMES_CONFLICT);
1112
+
1113
+ if (need_dir_renames) {
1114
+ get_provisional_directory_renames(opt, MERGE_SIDE1, &clean);
1115
+ get_provisional_directory_renames(opt, MERGE_SIDE2, &clean);
1116
+ handle_directory_level_conflicts(opt);
1117
+ }
1118
+
1119
ALLOC_GROW(combined.queue,
1120
renames->pairs[1].nr + renames->pairs[2].nr,
1121
combined.alloc);