From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 4/8] merge-tree: use ll_merge() not xdl_merge()
Date: Sun, 17 Jan 2010 01:39:00 -0800 [thread overview]
Message-ID: <1263721144-18605-5-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1263721144-18605-1-git-send-email-gitster@pobox.com>
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>
---
merge-file.c | 16 +++++++---------
merge-tree.c | 4 ++--
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/merge-file.c b/merge-file.c
index 5c00c7e..fd34d76 100644
--- a/merge-file.c
+++ b/merge-file.c
@@ -1,6 +1,7 @@
#include "cache.h"
#include "run-command.h"
#include "xdiff-interface.h"
+#include "ll-merge.h"
#include "blob.h"
static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
@@ -24,16 +25,13 @@ static void free_mmfile(mmfile_t *f)
free(f->ptr);
}
-static void *three_way_filemerge(mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
+static void *three_way_filemerge(const char *path, mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
{
- mmbuffer_t res;
- xmparam_t xmp;
int merge_status;
+ mmbuffer_t res;
- memset(&xmp, 0, sizeof(xmp));
- merge_status = xdl_merge(base, our, ".our", their, ".their",
- &xmp, XDL_MERGE_ZEALOUS, &res);
-
+ merge_status = ll_merge(&res, path, base,
+ our, ".our", their, ".their", 0);
if (merge_status < 0)
return NULL;
@@ -75,7 +73,7 @@ static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2)
return xdi_diff(f1, f2, &xpp, &xecfg, &ecb);
}
-void *merge_file(struct blob *base, struct blob *our, struct blob *their, unsigned long *size)
+void *merge_file(const char *path, struct blob *base, struct blob *our, struct blob *their, unsigned long *size)
{
void *res = NULL;
mmfile_t f1, f2, common;
@@ -108,7 +106,7 @@ void *merge_file(struct blob *base, struct blob *our, struct blob *their, unsign
if (generate_common_file(&common, &f1, &f2) < 0)
goto out_free_f2_f1;
}
- res = three_way_filemerge(&common, &f1, &f2, size);
+ res = three_way_filemerge(path, &common, &f1, &f2, size);
free_mmfile(&common);
out_free_f2_f1:
free_mmfile(&f2);
diff --git a/merge-tree.c b/merge-tree.c
index f01e7c8..37b94d9 100644
--- a/merge-tree.c
+++ b/merge-tree.c
@@ -54,7 +54,7 @@ static const char *explanation(struct merge_list *entry)
return "removed in remote";
}
-extern void *merge_file(struct blob *, struct blob *, struct blob *, unsigned long *);
+extern void *merge_file(const char *, struct blob *, struct blob *, struct blob *, unsigned long *);
static void *result(struct merge_list *entry, unsigned long *size)
{
@@ -76,7 +76,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
their = NULL;
if (entry)
their = entry->blob;
- return merge_file(base, our, their, size);
+ return merge_file(entry->path, base, our, their, size);
}
static void *origin(struct merge_list *entry, unsigned long *size)
--
1.6.6.405.g80ed6.dirty
next prev parent reply other threads:[~2010-01-17 9:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-17 9:38 [PATCH 0/8] Rescuing repeated merge of Documentation/git-merge.txt Junio C Hamano
2010-01-17 9:38 ` [PATCH 1/8] git_attr(): fix function signature Junio C Hamano
2010-01-17 9:38 ` [PATCH 2/8] xdl_merge(): introduce xmparam_t for merge specific parameters Junio C Hamano
2010-01-17 9:38 ` [PATCH 3/8] xdl_merge(): allow passing down marker_size in xmparam_t Junio C Hamano
2010-01-17 9:39 ` Junio C Hamano [this message]
2010-01-17 9:39 ` [PATCH 5/8] rerere: use ll_merge() instead of using xdl_merge() Junio C Hamano
2010-01-17 11:52 ` Johannes Sixt
2010-01-17 19:01 ` Junio C Hamano
2010-01-17 20:40 ` Johannes Sixt
2010-01-17 9:39 ` [PATCH 6/8] conflict-marker-size: new attribute Junio C Hamano
2010-01-17 9:39 ` [PATCH 7/8] rerere: prepare for customizable conflict marker length Junio C Hamano
2010-01-17 9:39 ` [PATCH 8/8] rerere: honor conflict-marker-size attribute Junio C Hamano
2010-01-17 10:07 ` [PATCH 0/8] Rescuing repeated merge of Documentation/git-merge.txt Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263721144-18605-5-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).