merge-tree: use ll_merge() not xdl_merge()
ll_merge() interface was designed to merge contents under git control while taking per-path attributes into account. Update the three-way merge implementation used by merge-tree to use it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jan 16, 2010 at 21:45 UTC
15b4f7a68d8c3c8ee28424415b203f61202d65d1
2 files changed
+9
-11
merge-file.c
+7
-9
@@ -1,6 +1,7 @@
1
#include "cache.h"
2
#include "run-command.h"
3
#include "xdiff-interface.h"
4
+#include "ll-merge.h"
5
#include "blob.h"
6
7
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
@@ -24,16 +25,13 @@ static void free_mmfile(mmfile_t *f)
25
free(f->ptr);
26
}
27
27
-static void *three_way_filemerge(mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
28
+static void *three_way_filemerge(const char *path, mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
29
{
29
- mmbuffer_t res;
30
- xmparam_t xmp;
30
int merge_status;
31
+ mmbuffer_t res;
32
33
- memset(&xmp, 0, sizeof(xmp));
34
- merge_status = xdl_merge(base, our, ".our", their, ".their",
35
- &xmp, XDL_MERGE_ZEALOUS, &res);
36
-
33
+ merge_status = ll_merge(&res, path, base,
34
+ our, ".our", their, ".their", 0);
35
if (merge_status < 0)
36
return NULL;
37
@@ -75,7 +73,7 @@ static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2)
73
return xdi_diff(f1, f2, &xpp, &xecfg, &ecb);
74
}
75
78
-void *merge_file(struct blob *base, struct blob *our, struct blob *their, unsigned long *size)
76
+void *merge_file(const char *path, struct blob *base, struct blob *our, struct blob *their, unsigned long *size)
77
{
78
void *res = NULL;
79
mmfile_t f1, f2, common;
@@ -108,7 +106,7 @@ void *merge_file(struct blob *base, struct blob *our, struct blob *their, unsign
106
if (generate_common_file(&common, &f1, &f2) < 0)
107
goto out_free_f2_f1;
108
}
111
- res = three_way_filemerge(&common, &f1, &f2, size);
109
+ res = three_way_filemerge(path, &common, &f1, &f2, size);
110
free_mmfile(&common);
111
out_free_f2_f1:
112
free_mmfile(&f2);
merge-tree.c
+2
-2
@@ -54,7 +54,7 @@ static const char *explanation(struct merge_list *entry)
54
return "removed in remote";
55
}
56
57
-extern void *merge_file(struct blob *, struct blob *, struct blob *, unsigned long *);
57
+extern void *merge_file(const char *, struct blob *, struct blob *, struct blob *, unsigned long *);
58
59
static void *result(struct merge_list *entry, unsigned long *size)
60
{
@@ -76,7 +76,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
76
their = NULL;
77
if (entry)
78
their = entry->blob;
79
- return merge_file(base, our, their, size);
79
+ return merge_file(entry->path, base, our, their, size);
80
}
81
82
static void *origin(struct merge_list *entry, unsigned long *size)