mmfile_t *orig,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
- int virtual_ancestor,
+ int flag,
int marker_size);
struct ll_merge_driver {
mmfile_t *orig,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
- int virtual_ancestor, int marker_size)
+ int flag, int marker_size)
{
/*
* The tentative merge result is "ours" for the final round,
* or common ancestor for an internal merge. Still return
* "conflicted merge" status.
*/
- mmfile_t *stolen = virtual_ancestor ? orig : src1;
+ mmfile_t *stolen = (flag & 01) ? orig : src1;
result->ptr = stolen->ptr;
result->size = stolen->size;
mmfile_t *orig,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
- int virtual_ancestor, int marker_size)
+ int flag, int marker_size)
{
xmparam_t xmp;
int style = 0;
+ int favor = (flag >> 1) & 03;
if (buffer_is_binary(orig->ptr, orig->size) ||
buffer_is_binary(src1->ptr, src1->size) ||
path,
orig, src1, name1,
src2, name2,
- virtual_ancestor, marker_size);
+ flag, marker_size);
}
memset(&xmp, 0, sizeof(xmp));
return xdl_merge(orig,
src1, name1,
src2, name2,
- &xmp, XDL_MERGE_ZEALOUS | style,
+ &xmp, XDL_MERGE_FLAGS(XDL_MERGE_ZEALOUS, style, favor),
result);
}
mmfile_t *orig,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
- int virtual_ancestor, int marker_size)
+ int flag, int marker_size)
{
char *src, *dst;
long size;
git_xmerge_style = 0;
status = ll_xdl_merge(drv_unused, result, path_unused,
orig, src1, NULL, src2, NULL,
- virtual_ancestor, marker_size);
+ flag, marker_size);
git_xmerge_style = saved_style;
if (status <= 0)
return status;
mmfile_t *orig,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
- int virtual_ancestor, int marker_size)
+ int flag, int marker_size)
{
char temp[4][50];
struct strbuf cmd = STRBUF_INIT;
{ "L", temp[3] },
{ NULL }
};
- const char *args[] = { "sh", "-c", NULL, NULL };
+ const char *args[] = { NULL, NULL };
int status, fd, i;
struct stat st;
strbuf_expand(&cmd, fn->cmdline, strbuf_expand_dict_cb, &dict);
- args[2] = cmd.buf;
- status = run_command_v_opt(args, 0);
+ args[0] = cmd.buf;
+ status = run_command_v_opt(args, RUN_USING_SHELL);
fd = open(temp[1], O_RDONLY);
if (fd < 0)
goto bad;
mmfile_t *ancestor,
mmfile_t *ours, const char *our_label,
mmfile_t *theirs, const char *their_label,
- int virtual_ancestor)
+ int flag)
{
static struct git_attr_check check[2];
const char *ll_driver_name = NULL;
int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
const struct ll_merge_driver *driver;
+ int virtual_ancestor = flag & 01;
if (!git_path_check_merge(path, check)) {
ll_driver_name = check[0].value;
driver = find_ll_merge_driver(driver->recursive);
return driver->fn(driver, result_buf, path, ancestor,
ours, our_label, theirs, their_label,
- virtual_ancestor, marker_size);
+ flag, marker_size);
+}
+
+int ll_merge_marker_size(const char *path)
+{
+ static struct git_attr_check check;
+ int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
+
+ if (!check.attr)
+ check.attr = git_attr("conflict-marker-size");
+ if (!git_checkattr(path, 1, &check) && check.value) {
+ marker_size = atoi(check.value);
+ if (marker_size <= 0)
+ marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
+ }
+ return marker_size;
}