git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/8] merge-tree: use ll_merge() not xdl_merge()

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 17, 2010, 09:39 UTC
Message-ID
<1263721144-18605-5-git-send-email-gitster@pobox.com>
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
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 13 in “Rescuing repeated merge of Documentation/git-merge.txt”
  1. 0/8 Rescuing repeated merge of Documentation/git-merge.txtJunio C Hamano, Jan 17, 2010
  2. 1/8 git_attr(): fix function signatureJunio C Hamano, Jan 17, 2010
  3. 2/8 xdl_merge(): introduce xmparam_t for merge specific parametersJunio C Hamano, Jan 17, 2010
  4. 3/8 xdl_merge(): allow passing down marker_size in xmparam_tJunio C Hamano, Jan 17, 2010
  5. 4/8 merge-tree: use ll_merge() not xdl_merge()Junio C Hamano, Jan 17, 2010
  6. 5/8 rerere: use ll_merge() instead of using xdl_merge()Junio C Hamano, Jan 17, 2010
  7. Johannes SixtJan 17, 2010
  8. Junio C HamanoJan 17, 2010
  9. Johannes SixtJan 17, 2010
  10. 6/8 conflict-marker-size: new attributeJunio C Hamano, Jan 17, 2010
  11. 7/8 rerere: prepare for customizable conflict marker lengthJunio C Hamano, Jan 17, 2010
  12. 8/8 rerere: honor conflict-marker-size attributeJunio C Hamano, Jan 17, 2010
  13. Junio C HamanoJan 17, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.