summaryrefslogtreecommitdiff
path: root/ll-merge.c
diff options
context:
space:
mode:
authorBert Wesarg <bert.wesarg@googlemail.com>2010-03-01 22:46:25 +0100
committerJunio C Hamano <gitster@pobox.com>2010-03-02 11:43:40 -0800
commitcd1d61c44fb5c3d1c8e4c19becb66d90bbb9c676 (patch)
tree339840994a9f049d433d90b73762679a6d6b0485 /ll-merge.c
parente923eaeb901ff056421b9007adcbbce271caa7b6 (diff)
downloadgit-cd1d61c44fb5c3d1c8e4c19becb66d90bbb9c676.tar.gz
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>
Diffstat (limited to 'll-merge.c')
-rw-r--r--ll-merge.c43
1 files changed, 5 insertions, 38 deletions
diff --git a/ll-merge.c b/ll-merge.c
index 4c7f11ba84..a4b2f4c964 100644
--- a/ll-merge.c
+++ b/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;
}