@@ -1023,6 +1023,43 @@ static int collect_merge_info_callback(int n,
return mask;
}
+ /*
+ * If the sides match, and all three paths are present and are
+ * files, then we can take either as the resolution. We can't do
+ * this with trees, because there may be rename sources from the
+ * merge_base.
+ */
+ if (sides_match && filemask == 0x07) {
+ /* use side1 (== side2) version as resolution */
+ setup_path_info(opt, &pi, dirname, info->pathlen, fullpath,
+ names, names+1, side1_null, 0,
+ filemask, dirmask, 1);
+ return mask;
+ }
+
+ /*
+ * If side1 matches mbase and all three paths are present and are
+ * files, then we can use side2 as the resolution. We cannot
+ * necessarily do so this for trees, because there may be rename
+ * destinations within side2.
+ */
+ if (side1_matches_mbase && filemask == 0x07) {
+ /* use side2 version as resolution */
+ setup_path_info(opt, &pi, dirname, info->pathlen, fullpath,
+ names, names+2, side2_null, 0,
+ filemask, dirmask, 1);
+ return mask;
+ }
+
+ /* Similar to above but swapping sides 1 and 2 */
+ if (side2_matches_mbase && filemask == 0x07) {
+ /* use side1 version as resolution */
+ setup_path_info(opt, &pi, dirname, info->pathlen, fullpath,
+ names, names+1, side1_null, 0,
+ filemask, dirmask, 1);
+ return mask;
+ }
+
/*
* Gather additional information used in rename detection.
*/