* 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,
static int ll_union_merge(const struct ll_merge_driver *drv_unused,
mmbuffer_t *result,
- const char *path_unused,
+ const char *path,
mmfile_t *orig, const char *orig_name,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
assert(opts);
o = *opts;
o.variant = XDL_MERGE_FAVOR_UNION;
- return ll_xdl_merge(drv_unused, result, path_unused,
- orig, NULL, src1, NULL, src2, NULL,
+ return ll_xdl_merge(drv_unused, result, path,
+ orig, orig_name, src1, name1, src2, name2,
&o, marker_size);
}
git merge main
'
+test_expect_success 'binary files with union attribute' '
+ git checkout -b bin-main &&
+ printf "base\0" >bin.txt &&
+ echo "bin.txt merge=union" >.gitattributes &&
+ git add bin.txt .gitattributes &&
+ git commit -m base &&
+
+ printf "one\0" >bin.txt &&
+ git commit -am one &&
+
+ git checkout -b bin-side HEAD^ &&
+ printf "two\0" >bin.txt &&
+ git commit -am two &&
+
+ test_must_fail git merge bin-main 2>stderr &&
+ grep -i "warning.*cannot merge.*HEAD vs. bin-main" stderr
+'
+
test_done