Skip to content

Commit 04af187

Browse files
newrengitster
authored andcommitted
merge-ort: add function grouping comments
Commit b658536 ("merge-ort: add some high-level algorithm structure", 2020-10-27) added high-level structure of the ort merge algorithm. As we have added more and more functions, that high-level structure has been slightly obscured. Since functions are still grouped according to this high-level structure, add comments denoting sections where all the functions are specifically tied to a piece of the high-level structure. This function groupings include a few sub-divisions of the original high-level structure, including some sub-divisions that are yet to be submitted. Each has (or will have) several functions all serving as helpers to one or two main functions for each section. As an added bonus, the comments will serve to provide a small textual separation between nearby sections and allow the next three patch series to be submitted independently and merge cleanly. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 43c1dcc commit 04af187

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

merge-ort.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ struct conflict_info {
210210
unsigned match_mask:3;
211211
};
212212

213+
/*** Function Grouping: various utility functions ***/
214+
213215
/*
214216
* For the next three macros, see warning for conflict_info.merged.
215217
*
@@ -290,6 +292,8 @@ static int err(struct merge_options *opt, const char *err, ...)
290292
return -1;
291293
}
292294

295+
/*** Function Grouping: functions related to collect_merge_info() ***/
296+
293297
static void setup_path_info(struct merge_options *opt,
294298
struct string_list_item *result,
295299
const char *current_dir_name,
@@ -544,6 +548,15 @@ static int collect_merge_info(struct merge_options *opt,
544548
return ret;
545549
}
546550

551+
/*** Function Grouping: functions related to threeway content merges ***/
552+
553+
/*** Function Grouping: functions related to detect_and_process_renames(), ***
554+
*** which are split into directory and regular rename detection sections. ***/
555+
556+
/*** Function Grouping: functions related to directory rename detection ***/
557+
558+
/*** Function Grouping: functions related to regular rename detection ***/
559+
547560
static int detect_and_process_renames(struct merge_options *opt,
548561
struct tree *merge_base,
549562
struct tree *side1,
@@ -561,6 +574,8 @@ static int detect_and_process_renames(struct merge_options *opt,
561574
return clean;
562575
}
563576

577+
/*** Function Grouping: functions related to process_entries() ***/
578+
564579
static int string_list_df_name_compare(const char *one, const char *two)
565580
{
566581
int onelen = strlen(one);
@@ -1039,6 +1054,8 @@ static void process_entries(struct merge_options *opt,
10391054
string_list_clear(&dir_metadata.offsets, 0);
10401055
}
10411056

1057+
/*** Function Grouping: functions related to merge_switch_to_result() ***/
1058+
10421059
static int checkout(struct merge_options *opt,
10431060
struct tree *prev,
10441061
struct tree *next)
@@ -1226,6 +1243,8 @@ void merge_finalize(struct merge_options *opt,
12261243
FREE_AND_NULL(opti);
12271244
}
12281245

1246+
/*** Function Grouping: helper functions for merge_incore_*() ***/
1247+
12291248
static void merge_start(struct merge_options *opt, struct merge_result *result)
12301249
{
12311250
/* Sanity checks on opt */
@@ -1276,6 +1295,8 @@ static void merge_start(struct merge_options *opt, struct merge_result *result)
12761295
string_list_init(&opt->priv->paths_to_free, 0);
12771296
}
12781297

1298+
/*** Function Grouping: merge_incore_*() and their internal variants ***/
1299+
12791300
/*
12801301
* Originally from merge_trees_internal(); heavily adapted, though.
12811302
*/

0 commit comments

Comments
 (0)