コード例 #1
0
ファイル: ll-merge.c プロジェクト: DJHartley/git
static int ll_union_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)
{
	char *src, *dst;
	long size;
	const int marker_size = 7;
	int status, saved_style;

	/* We have to force the RCS "merge" style */
	saved_style = git_xmerge_style;
	git_xmerge_style = 0;
	status = ll_xdl_merge(drv_unused, result, path_unused,
			      orig, src1, NULL, src2, NULL,
			      virtual_ancestor);
	git_xmerge_style = saved_style;
	if (status <= 0)
		return status;
	size = result->size;
	src = dst = result->ptr;
	while (size) {
		char ch;
		if ((marker_size < size) &&
		    (*src == '<' || *src == '=' || *src == '>')) {
			int i;
			ch = *src;
			for (i = 0; i < marker_size; i++)
				if (src[i] != ch)
					goto not_a_marker;
			if (src[marker_size] != '\n')
				goto not_a_marker;
			src += marker_size + 1;
			size -= marker_size + 1;
			continue;
		}
	not_a_marker:
		do {
			ch = *src++;
			*dst++ = ch;
			size--;
		} while (ch != '\n' && size);
	}
	result->size = dst - result->ptr;
	return 0;
}
コード例 #2
0
ファイル: ll-merge.c プロジェクト: sanj/git
static int ll_union_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 flag, int marker_size)
{
	/* Use union favor */
	flag = (flag & 1) | (XDL_MERGE_FAVOR_UNION << 1);
	return ll_xdl_merge(drv_unused, result, path_unused,
			    orig, src1, NULL, src2, NULL,
			    flag, marker_size);
	return 0;
}
コード例 #3
0
ファイル: ll-merge.c プロジェクト: qmx/git
static int ll_union_merge(const struct ll_merge_driver *drv_unused,
                          mmbuffer_t *result,
                          const char *path_unused,
                          mmfile_t *orig, const char *orig_name,
                          mmfile_t *src1, const char *name1,
                          mmfile_t *src2, const char *name2,
                          int flag, int marker_size)
{
    /* Use union favor */
    flag &= ~LL_OPT_FAVOR_MASK;
    flag |= create_ll_flag(XDL_MERGE_FAVOR_UNION);
    return ll_xdl_merge(drv_unused, result, path_unused,
                        orig, NULL, src1, NULL, src2, NULL,
                        flag, marker_size);
    return 0;
}
コード例 #4
0
ファイル: ll-merge.c プロジェクト: UndefinedBehaviour/git
static int ll_union_merge(const struct ll_merge_driver *drv_unused,
			  mmbuffer_t *result,
			  const char *path_unused,
			  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)
{
	/* Use union favor */
	struct ll_merge_options o;
	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,
			    &o, marker_size);
}