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 <gitster@pobox.com>
This commit is contained in:
parent
155a4b712e
commit
e0e2065f74
@ -35,7 +35,7 @@ struct ll_merge_driver {
|
|||||||
*/
|
*/
|
||||||
static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
|
static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
|
||||||
mmbuffer_t *result,
|
mmbuffer_t *result,
|
||||||
const char *path_unused,
|
const char *path,
|
||||||
mmfile_t *orig, const char *orig_name,
|
mmfile_t *orig, const char *orig_name,
|
||||||
mmfile_t *src1, const char *name1,
|
mmfile_t *src1, const char *name1,
|
||||||
mmfile_t *src2, const char *name2,
|
mmfile_t *src2, const char *name2,
|
||||||
@ -53,6 +53,9 @@ static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
|
|||||||
} else {
|
} else {
|
||||||
switch (opts->variant) {
|
switch (opts->variant) {
|
||||||
default:
|
default:
|
||||||
|
warning("Cannot merge binary files: %s (%s vs. %s)\n",
|
||||||
|
path, name1, name2);
|
||||||
|
/* fallthru */
|
||||||
case XDL_MERGE_FAVOR_OURS:
|
case XDL_MERGE_FAVOR_OURS:
|
||||||
stolen = src1;
|
stolen = src1;
|
||||||
break;
|
break;
|
||||||
@ -88,8 +91,6 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
|
|||||||
if (buffer_is_binary(orig->ptr, orig->size) ||
|
if (buffer_is_binary(orig->ptr, orig->size) ||
|
||||||
buffer_is_binary(src1->ptr, src1->size) ||
|
buffer_is_binary(src1->ptr, src1->size) ||
|
||||||
buffer_is_binary(src2->ptr, src2->size)) {
|
buffer_is_binary(src2->ptr, src2->size)) {
|
||||||
warning("Cannot merge binary files: %s (%s vs. %s)\n",
|
|
||||||
path, name1, name2);
|
|
||||||
return ll_binary_merge(drv_unused, result,
|
return ll_binary_merge(drv_unused, result,
|
||||||
path,
|
path,
|
||||||
orig, orig_name,
|
orig, orig_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user