Skip to content

Commit 0270a07

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75f3fa7 commit 0270a07

File tree

1 file changed

+17
-27
lines changed

1 file changed

+17
-27
lines changed

merge-recursive.c

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,27 +1366,6 @@ static int merge_file_1(struct merge_options *o,
13661366
return 0;
13671367
}
13681368

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-
13901369
static int handle_rename_via_dir(struct merge_options *o,
13911370
struct diff_filepair *pair,
13921371
const char *rename_branch,
@@ -2730,12 +2709,23 @@ static int process_renames(struct merge_options *o,
27302709
ren1_dst, branch2);
27312710
if (o->call_depth) {
27322711
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)) {
27392729
clean_merge = -1;
27402730
goto cleanup_and_return;
27412731
}

0 commit comments

Comments
 (0)