Skip to content

Commit e0e2065

Browse files
committed
ll-merge: warn about inability to merge binary files only when we can't
When a path being merged is auto detected to be a binary file, we warned "Cannot merge binary files" before switching to activate the binary ll-merge driver. When we are merging with the -Xours/theirs option, however, we know what the "clean" merge result is, and the warning is inappropriate. In addition, when the path is explicitly marked as a binary file, this warning was not issued, even though without -Xours/theirs, we cannot cleanly automerge such a path, which was inconsistent. Move the warning code from ll_xdl_merge() to ll_binary_merge(), and issue the message only when we cannot cleanly automerge. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 155a4b7 commit e0e2065

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ll-merge.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct ll_merge_driver {
3535
*/
3636
static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
3737
mmbuffer_t *result,
38-
const char *path_unused,
38+
const char *path,
3939
mmfile_t *orig, const char *orig_name,
4040
mmfile_t *src1, const char *name1,
4141
mmfile_t *src2, const char *name2,
@@ -53,6 +53,9 @@ static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
5353
} else {
5454
switch (opts->variant) {
5555
default:
56+
warning("Cannot merge binary files: %s (%s vs. %s)\n",
57+
path, name1, name2);
58+
/* fallthru */
5659
case XDL_MERGE_FAVOR_OURS:
5760
stolen = src1;
5861
break;
@@ -88,8 +91,6 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
8891
if (buffer_is_binary(orig->ptr, orig->size) ||
8992
buffer_is_binary(src1->ptr, src1->size) ||
9093
buffer_is_binary(src2->ptr, src2->size)) {
91-
warning("Cannot merge binary files: %s (%s vs. %s)\n",
92-
path, name1, name2);
9394
return ll_binary_merge(drv_unused, result,
9495
path,
9596
orig, orig_name,

0 commit comments

Comments
 (0)