merge-ort: add some more explanations in collect_merge_info_callback()

The previous patch possibly raises some questions about whether additional cases in collect_merge_info_callback() can be handled early. Add some explanations in the form of comments to help explain these better. While we're at it, add a few comments to denote what a few boolean '0' or '1' values stand for. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jul 16, 2021 at 05:22 UTC 528fc51b6d899e080a877f9420efcca86c98b35e
1 file changed +15 -5
merge-ort.c
+15 -5
@@ -1018,8 +1018,8 @@ static int collect_merge_info_callback(int n,
1018 if (side1_matches_mbase && side2_matches_mbase) {
1019 /* mbase, side1, & side2 all match; use mbase as resolution */
1020 setup_path_info(opt, &pi, dirname, info->pathlen, fullpath,
1021 - names, names+0, mbase_null, 0,
1022 - filemask, dirmask, 1);
1021 + names, names+0, mbase_null, 0 /* df_conflict */,
1022 + filemask, dirmask, 1 /* resolved */);
1023 return mask;
1024 }
1025
@@ -1061,14 +1061,24 @@ static int collect_merge_info_callback(int n,
1061 }
1062
1063 /*
1064 - * Gather additional information used in rename detection.
1064 + * Sometimes we can tell that a source path need not be included in
1065 + * rename detection -- namely, whenever either
1066 + * side1_matches_mbase && side2_null
1067 + * or
1068 + * side2_matches_mbase && side1_null
1069 + * However, we call collect_rename_info() even in those cases,
1070 + * because exact renames are cheap and would let us remove both a
1071 + * source and destination path. We'll cull the unneeded sources
1072 + * later.
1073 */
1074 collect_rename_info(opt, names, dirname, fullpath,
1075 filemask, dirmask, match_mask);
1076
1077 /*
1070 - * Record information about the path so we can resolve later in
1071 - * process_entries.
1078 + * None of the special cases above matched, so we have a
1079 + * provisional conflict. (Rename detection might allow us to
1080 + * unconflict some more cases, but that comes later so all we can
1081 + * do now is record the different non-null file hashes.)
1082 */
1083 setup_path_info(opt, &pi, dirname, info->pathlen, fullpath,
1084 names, NULL, 0, df_conflict, filemask, dirmask, 0);