Skip to content

Commit 5b26c3c

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8ebe7b0 commit 5b26c3c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

merge-recursive.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,21 @@ static int handle_change_delete(struct merge_options *o,
14761476
if (!ret)
14771477
ret = update_file(o, 0, o_oid, o_mode, update_path);
14781478
} 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+
*/
14791494
if (!alt_path) {
14801495
if (!old_path) {
14811496
output(o, 1, _("CONFLICT (%s/delete): %s deleted in %s "

0 commit comments

Comments
 (0)