Esempio n. 1
0
File: ll-merge.c Progetto: qmx/git
static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
                        mmbuffer_t *result,
                        const char *path,
                        mmfile_t *orig, const char *orig_name,
                        mmfile_t *src1, const char *name1,
                        mmfile_t *src2, const char *name2,
                        int flag, int marker_size)
{
    xmparam_t xmp;

    if (buffer_is_binary(orig->ptr, orig->size) ||
            buffer_is_binary(src1->ptr, src1->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,
                               path,
                               orig, orig_name,
                               src1, name1,
                               src2, name2,
                               flag, marker_size);
    }

    memset(&xmp, 0, sizeof(xmp));
    xmp.level = XDL_MERGE_ZEALOUS;
    xmp.favor = ll_opt_favor(flag);
    if (git_xmerge_style >= 0)
        xmp.style = git_xmerge_style;
    if (marker_size > 0)
        xmp.marker_size = marker_size;
    xmp.ancestor = orig_name;
    xmp.file1 = name1;
    xmp.file2 = name2;
    return xdl_merge(orig, src1, src2, &xmp, result);
}
Esempio n. 2
0
static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
			mmbuffer_t *result,
			const char *path_unused,
			mmfile_t *orig,
			mmfile_t *src1, const char *name1,
			mmfile_t *src2, const char *name2,
			int virtual_ancestor)
{
	xpparam_t xpp;

	if (buffer_is_binary(orig->ptr, orig->size) ||
	    buffer_is_binary(src1->ptr, src1->size) ||
	    buffer_is_binary(src2->ptr, src2->size)) {
		warning("Cannot merge binary files: %s vs. %s\n",
			name1, name2);
		return ll_binary_merge(drv_unused, result,
				       path_unused,
				       orig, src1, name1,
				       src2, name2,
				       virtual_ancestor);
	}

	memset(&xpp, 0, sizeof(xpp));
	return xdl_merge(orig,
			 src1, name1,
			 src2, name2,
			 &xpp, XDL_MERGE_ZEALOUS,
			 result);
}
Esempio n. 3
0
static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
			mmbuffer_t *result,
			const char *path,
			mmfile_t *orig,
			mmfile_t *src1, const char *name1,
			mmfile_t *src2, const char *name2,
			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) ||
	    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,
				       path,
				       orig, src1, name1,
				       src2, name2,
				       flag, marker_size);
	}

	memset(&xmp, 0, sizeof(xmp));
	if (git_xmerge_style >= 0)
		style = git_xmerge_style;
	if (marker_size > 0)
		xmp.marker_size = marker_size;
	return xdl_merge(orig,
			 src1, name1,
			 src2, name2,
			 &xmp, XDL_MERGE_FLAGS(XDL_MERGE_ZEALOUS, style, favor),
			 result);
}
Esempio n. 4
0
static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
			mmbuffer_t *result,
			const char *path,
			mmfile_t *orig, const char *orig_name,
			mmfile_t *src1, const char *name1,
			mmfile_t *src2, const char *name2,
			const struct ll_merge_options *opts,
			int marker_size)
{
	xmparam_t xmp;
	assert(opts);

	if (orig->size > MAX_XDIFF_SIZE ||
	    src1->size > MAX_XDIFF_SIZE ||
	    src2->size > MAX_XDIFF_SIZE ||
	    buffer_is_binary(orig->ptr, orig->size) ||
	    buffer_is_binary(src1->ptr, src1->size) ||
	    buffer_is_binary(src2->ptr, src2->size)) {
		return ll_binary_merge(drv_unused, result,
				       path,
				       orig, orig_name,
				       src1, name1,
				       src2, name2,
				       opts, marker_size);
	}

	memset(&xmp, 0, sizeof(xmp));
	xmp.level = XDL_MERGE_ZEALOUS;
	xmp.favor = opts->variant;
	xmp.mark_all = opts->mark_all_changes;
	xmp.xpp.flags = opts->xdl_opts;
	if (git_xmerge_style >= 0)
		xmp.style = git_xmerge_style;
	if (marker_size > 0)
		xmp.marker_size = marker_size;
	xmp.ancestor = orig_name;
	xmp.file1 = name1;
	xmp.file2 = name2;
	return xdl_merge(orig, src1, src2, &xmp, result);
}