merge-recursive: add pointer about unduly complex looking code

handle_change_delete() has a block of code displaying one of four nearly identical messages. Each contains about half a dozen variable interpolations, which use nearly identical variables as well. Someone trying to parse this may be slowed down trying to parse the differences and why they are here; help them out by adding a comment explaining the differences. Further, point out that this code structure isn't collapsed into something more concise and readable for the programmer, because we want to keep full messages intact in order to make translators' jobs much easier. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jun 9, 2018 at 21:16 UTC 5b26c3c941d3c7cd96be668e1778ba22cc4829d5
1 file changed +15
merge-recursive.c
+15
@@ -1476,6 +1476,21 @@ static int handle_change_delete(struct merge_options *o,
1476 if (!ret)
1477 ret = update_file(o, 0, o_oid, o_mode, update_path);
1478 } else {
1479 + /*
1480 + * Despite the four nearly duplicate messages and argument
1481 + * lists below and the ugliness of the nested if-statements,
1482 + * having complete messages makes the job easier for
1483 + * translators.
1484 + *
1485 + * The slight variance among the cases is due to the fact
1486 + * that:
1487 + * 1) directory/file conflicts (in effect if
1488 + * !alt_path) could cause us to need to write the
1489 + * file to a different path.
1490 + * 2) renames (in effect if !old_path) could mean that
1491 + * there are two names for the path that the user
1492 + * may know the file by.
1493 + */
1494 if (!alt_path) {
1495 if (!old_path) {
1496 output(o, 1, _("CONFLICT (%s/delete): %s deleted in %s "