merge-recursive: remove final remaining caller of merge_file_one()

The function names merge_file_one() and merge_file_1() aren't particularly intuitive function names, especially since there is no associated merge_file() function that these are related to. The previous commit showed that merge_file_one() was prone to be called when merge_file_1() should be, and since it is just a thin wrapper around merge_file_1() anyway and only has one caller left, let's just remove merge_file_one() entirely. (It also turns out that the one remaining caller of merge_file_one() has very broken code that needs to be completely rewritten, but that's the subject of a future patch series; for now, we're just translating it into a merge_file_1() call.) Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Sep 19, 2018 at 09:14 UTC 0270a07ad0b22734920fb92f58052b213c2f9bc8
1 file changed +17 -27
merge-recursive.c
+17 -27
@@ -1366,27 +1366,6 @@ static int merge_file_1(struct merge_options *o,
1366 return 0;
1367 }
1368
1369 -static int merge_file_one(struct merge_options *o,
1370 - const char *path,
1371 - const struct object_id *o_oid, int o_mode,
1372 - const struct object_id *a_oid, int a_mode,
1373 - const struct object_id *b_oid, int b_mode,
1374 - const char *branch1,
1375 - const char *branch2,
1376 - struct merge_file_info *mfi)
1377 -{
1378 - struct diff_filespec one, a, b;
1379 -
1380 - one.path = a.path = b.path = (char *)path;
1381 - oidcpy(&one.oid, o_oid);
1382 - one.mode = o_mode;
1383 - oidcpy(&a.oid, a_oid);
1384 - a.mode = a_mode;
1385 - oidcpy(&b.oid, b_oid);
1386 - b.mode = b_mode;
1387 - return merge_file_1(o, &one, &a, &b, path, branch1, branch2, mfi);
1388 -}
1389 -
1369 static int handle_rename_via_dir(struct merge_options *o,
1370 struct diff_filepair *pair,
1371 const char *rename_branch,
@@ -2730,12 +2709,23 @@ static int process_renames(struct merge_options *o,
2709 ren1_dst, branch2);
2710 if (o->call_depth) {
2711 struct merge_file_info mfi;
2733 - if (merge_file_one(o, ren1_dst, &null_oid, 0,
2734 - &ren1->pair->two->oid,
2735 - ren1->pair->two->mode,
2736 - &dst_other.oid,
2737 - dst_other.mode,
2738 - branch1, branch2, &mfi)) {
2712 + struct diff_filespec one, a, b;
2713 +
2714 + oidcpy(&one.oid, &null_oid);
2715 + one.mode = 0;
2716 + one.path = ren1->pair->two->path;
2717 +
2718 + oidcpy(&a.oid, &ren1->pair->two->oid);
2719 + a.mode = ren1->pair->two->mode;
2720 + a.path = one.path;
2721 +
2722 + oidcpy(&b.oid, &dst_other.oid);
2723 + b.mode = dst_other.mode;
2724 + b.path = one.path;
2725 +
2726 + if (merge_file_1(o, &one, &a, &b, ren1_dst,
2727 + branch1, branch2,
2728 + &mfi)) {
2729 clean_merge = -1;
2730 goto cleanup_and_return;
2731 }