Skip to content

Commit 15b4f7a

Browse files
committed
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 <[email protected]>
1 parent 9914cf4 commit 15b4f7a

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

merge-file.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "cache.h"
22
#include "run-command.h"
33
#include "xdiff-interface.h"
4+
#include "ll-merge.h"
45
#include "blob.h"
56

67
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
@@ -24,16 +25,13 @@ static void free_mmfile(mmfile_t *f)
2425
free(f->ptr);
2526
}
2627

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)
2829
{
29-
mmbuffer_t res;
30-
xmparam_t xmp;
3130
int merge_status;
31+
mmbuffer_t res;
3232

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);
3735
if (merge_status < 0)
3836
return NULL;
3937

@@ -75,7 +73,7 @@ static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2)
7573
return xdi_diff(f1, f2, &xpp, &xecfg, &ecb);
7674
}
7775

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)
7977
{
8078
void *res = NULL;
8179
mmfile_t f1, f2, common;
@@ -108,7 +106,7 @@ void *merge_file(struct blob *base, struct blob *our, struct blob *their, unsign
108106
if (generate_common_file(&common, &f1, &f2) < 0)
109107
goto out_free_f2_f1;
110108
}
111-
res = three_way_filemerge(&common, &f1, &f2, size);
109+
res = three_way_filemerge(path, &common, &f1, &f2, size);
112110
free_mmfile(&common);
113111
out_free_f2_f1:
114112
free_mmfile(&f2);

merge-tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static const char *explanation(struct merge_list *entry)
5454
return "removed in remote";
5555
}
5656

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 *);
5858

5959
static void *result(struct merge_list *entry, unsigned long *size)
6060
{
@@ -76,7 +76,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
7676
their = NULL;
7777
if (entry)
7878
their = entry->blob;
79-
return merge_file(base, our, their, size);
79+
return merge_file(entry->path, base, our, their, size);
8080
}
8181

8282
static void *origin(struct merge_list *entry, unsigned long *size)

0 commit comments

Comments
 (0)