summaryrefslogtreecommitdiff
path: root/ll-merge.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2021-06-10 12:57:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-06-11 03:37:04 (GMT)
commit7d879ad7e02f1f4d7f504862b280e503db403a36 (patch)
tree7b3cccd371edb865dd9f75b39074e7fc411d608e /ll-merge.c
parent48bf2fa8bad054d66bd79c6ba903c89c704201f7 (diff)
downloadgit-7d879ad7e02f1f4d7f504862b280e503db403a36.zip
git-7d879ad7e02f1f4d7f504862b280e503db403a36.tar.gz
git-7d879ad7e02f1f4d7f504862b280e503db403a36.tar.bz2
ll_binary_merge(): handle XDL_MERGE_FAVOR_UNION
Prior to commit a944af1d86 (merge: teach -Xours/-Xtheirs to binary ll-merge driver, 2012-09-08), we always reported a conflict from ll_binary_merge() by returning "1" (in the xdl_merge and ll_merge code, this value is the number of conflict hunks). After that commit, we report zero conflicts if the "variant" flag is set, under the assumption that it is one of XDL_MERGE_FAVOR_OURS or XDL_MERGE_FAVOR_THEIRS. But this gets confused by XDL_MERGE_FAVOR_UNION. We do not know how to do a binary union merge, but erroneously report no conflicts anyway (and just blindly use the "ours" content as the result). Let's tighten our check to just the cases that a944af1d86 meant to cover. This fixes the union case (which existed already back when that commit was made), as well as future-proofing us against any other variants that get added later. Note that you can't trigger this from "git merge-file --union", as that bails on binary files before even calling into the ll-merge machinery. The test here uses the "union" merge attribute, which does erroneously report a successful merge. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'll-merge.c')
-rw-r--r--ll-merge.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ll-merge.c b/ll-merge.c
index 9a8a2c3..145deb1 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -91,7 +91,9 @@ static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
* With -Xtheirs or -Xours, we have cleanly merged;
* otherwise we got a conflict.
*/
- return (opts->variant ? 0 : 1);
+ return opts->variant == XDL_MERGE_FAVOR_OURS ||
+ opts->variant == XDL_MERGE_FAVOR_THEIRS ?
+ 0 : 1;
}
static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,