make union merge an xdl merge favor
The current union merge driver is implemented as an post process. But the xdl_merge code is quite capable to produce the result by itself. Therefore move it there. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
e923eaeb90
commit
cd1d61c44f
43
ll-merge.c
43
ll-merge.c
@ -98,44 +98,11 @@ static int ll_union_merge(const struct ll_merge_driver *drv_unused,
|
||||
mmfile_t *src2, const char *name2,
|
||||
int flag, int marker_size)
|
||||
{
|
||||
char *src, *dst;
|
||||
long size;
|
||||
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,
|
||||
flag, marker_size);
|
||||
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;
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user