Skip to content

Commit 528fc51

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 785bf20 commit 528fc51

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

merge-ort.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,8 +1018,8 @@ static int collect_merge_info_callback(int n,
10181018
if (side1_matches_mbase && side2_matches_mbase) {
10191019
/* mbase, side1, & side2 all match; use mbase as resolution */
10201020
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 */);
10231023
return mask;
10241024
}
10251025

@@ -1061,14 +1061,24 @@ static int collect_merge_info_callback(int n,
10611061
}
10621062

10631063
/*
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.
10651073
*/
10661074
collect_rename_info(opt, names, dirname, fullpath,
10671075
filemask, dirmask, match_mask);
10681076

10691077
/*
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.)
10721082
*/
10731083
setup_path_info(opt, &pi, dirname, info->pathlen, fullpath,
10741084
names, NULL, 0, df_conflict, filemask, dirmask, 0);

0 commit comments

Comments
 (0)