1063
}
1064
1065
static int merge_file_1(struct merge_options *o,
1066
- const struct diff_filespec *one,
1067
- const struct diff_filespec *a,
1068
- const struct diff_filespec *b,
1069
- const char *branch1,
1070
- const char *branch2,
1071
- struct merge_file_info *result)
1066
+ const struct diff_filespec *one,
1067
+ const struct diff_filespec *a,
1068
+ const struct diff_filespec *b,
1069
+ const char *filename,
1070
+ const char *branch1,
1071
+ const char *branch2,
1072
+ struct merge_file_info *result)
1073
{
1074
result->merge = 0;
1075
result->clean = 1;
1149
die("BUG: unsupported object type in the tree");
1150
}
1151
1152
+ if (result->merge)
1153
+ output(o, 2, _("Auto-merging %s"), filename);
1154
+
1155
return 0;
1156
}
1157
1158
static int merge_file_special_markers(struct merge_options *o,
1155
- const struct diff_filespec *one,
1156
- const struct diff_filespec *a,
1157
- const struct diff_filespec *b,
1158
- const char *branch1,
1159
- const char *filename1,
1160
- const char *branch2,
1161
- const char *filename2,
1162
- struct merge_file_info *mfi)
1159
+ const struct diff_filespec *one,
1160
+ const struct diff_filespec *a,
1161
+ const struct diff_filespec *b,
1162
+ const char *target_filename,
1163
+ const char *branch1,
1164
+ const char *filename1,
1165
+ const char *branch2,
1166
+ const char *filename2,
1167
+ struct merge_file_info *mfi)
1168
{
1169
char *side1 = NULL;
1170
char *side2 = NULL;
1175
if (filename2)
1176
side2 = xstrfmt("%s:%s", branch2, filename2);
1177
1173
- ret = merge_file_1(o, one, a, b,
1178
+ ret = merge_file_1(o, one, a, b, target_filename,
1179
side1 ? side1 : branch1,
1180
side2 ? side2 : branch2, mfi);
1181
+
1182
free(side1);
1183
free(side2);
1184
return ret;
1185
}
1186
1187
static int merge_file_one(struct merge_options *o,
1182
- const char *path,
1183
- const struct object_id *o_oid, int o_mode,
1184
- const struct object_id *a_oid, int a_mode,
1185
- const struct object_id *b_oid, int b_mode,
1186
- const char *branch1,
1187
- const char *branch2,
1188
- struct merge_file_info *mfi)
1188
+ const char *path,
1189
+ const struct object_id *o_oid, int o_mode,
1190
+ const struct object_id *a_oid, int a_mode,
1191
+ const struct object_id *b_oid, int b_mode,
1192
+ const char *branch1,
1193
+ const char *branch2,
1194
+ struct merge_file_info *mfi)
1195
{
1196
struct diff_filespec one, a, b;
1197
1202
a.mode = a_mode;
1203
oidcpy(&b.oid, b_oid);
1204
b.mode = b_mode;
1199
- return merge_file_1(o, &one, &a, &b, branch1, branch2, mfi);
1205
+ return merge_file_1(o, &one, &a, &b, path, branch1, branch2, mfi);
1206
}
1207
1208
static int conflict_rename_dir(struct merge_options *o,
1480
struct diff_filespec *c1 = ci->pair1->two;
1481
struct diff_filespec *c2 = ci->pair2->two;
1482
char *path = c1->path; /* == c2->path */
1483
+ char *path_side_1_desc;
1484
+ char *path_side_2_desc;
1485
struct merge_file_info mfi_c1;
1486
struct merge_file_info mfi_c2;
1487
int ret;
1495
remove_file(o, 1, a->path, o->call_depth || would_lose_untracked(a->path));
1496
remove_file(o, 1, b->path, o->call_depth || would_lose_untracked(b->path));
1497
1498
+ path_side_1_desc = xstrfmt("%s (was %s)", path, a->path);
1499
+ path_side_2_desc = xstrfmt("%s (was %s)", path, b->path);
1500
if (merge_file_special_markers(o, a, c1, &ci->ren1_other,
1501
+ path_side_1_desc,
1502
o->branch1, c1->path,
1503
o->branch2, ci->ren1_other.path, &mfi_c1) ||
1504
merge_file_special_markers(o, b, &ci->ren2_other, c2,
1505
+ path_side_2_desc,
1506
o->branch1, ci->ren2_other.path,
1507
o->branch2, c2->path, &mfi_c2))
1508
return -1;
1509
+ free(path_side_1_desc);
1510
+ free(path_side_2_desc);
1511
1512
if (o->call_depth) {
1513
/*
2816
S_ISGITLINK(pair1->two->mode)))
2817
df_conflict_remains = 1;
2818
}
2805
- if (merge_file_special_markers(o, &one, &a, &b,
2819
+ if (merge_file_special_markers(o, &one, &a, &b, path,
2820
o->branch1, path1,
2821
o->branch2, path2, &mfi))
2822
return -1;
2838
return -1;
2839
return mfi.clean;
2840
}
2827
- } else
2828
- output(o, 2, _("Auto-merging %s"), path);
2841
+ }
2842
2843
if (!mfi.clean) {
2844
if (S_ISGITLINK(mfi.mode))