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

[PATCH 8/8] rerere: honor conflict-marker-size attribute

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 17, 2010, 09:39 UTC
Message-ID
<1263721144-18605-9-git-send-email-gitster@pobox.com>
In-Reply-To
<1263721144-18605-1-git-send-email-gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 ll-merge.c |   15 +++++++++++++++
 ll-merge.h |    2 ++
 rerere.c   |    5 +++--
 3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/ll-merge.c b/ll-merge.c
index d682071..0dcaae0 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -380,3 +380,18 @@ int ll_merge(mmbuffer_t *result_buf,
 			  ours, our_label, theirs, their_label,
 			  virtual_ancestor, marker_size);
 }
+
+int ll_merge_marker_size(const char *path)
+{
+	static struct git_attr_check check;
+	int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
+
+	if (!check.attr)
+		check.attr = git_attr("conflict-marker-size");
+	if (!git_checkattr(path, 1, &check) && check.value) {
+		marker_size = atoi(check.value);
+		if (marker_size <= 0)
+			marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
+	}
+	return marker_size;
+}
diff --git a/ll-merge.h b/ll-merge.h
index 5388422..ff5d84a 100644
--- a/ll-merge.h
+++ b/ll-merge.h
@@ -12,4 +12,6 @@ int ll_merge(mmbuffer_t *result_buf,
 	     mmfile_t *theirs, const char *their_label,
 	     int virtual_ancestor);
 
+int ll_merge_marker_size(const char *path);
+
 #endif
diff --git a/rerere.c b/rerere.c
index d4d1507..2a2bd23 100644
--- a/rerere.c
+++ b/rerere.c
@@ -5,6 +5,7 @@
 #include "dir.h"
 #include "resolve-undo.h"
 #include "ll-merge.h"
+#include "attr.h"
 
 /* if rerere_enabled == -1, fall back to detection of .git/rr-cache */
 static int rerere_enabled = -1;
@@ -218,7 +219,7 @@ static int handle_file(const char *path, unsigned char *sha1, const char *output
 {
 	int hunk_no = 0;
 	struct rerere_io_file io;
-	int marker_size = 7;
+	int marker_size = ll_merge_marker_size(path);
 
 	memset(&io, 0, sizeof(io));
 	io.io.getline = rerere_file_getline;
@@ -285,7 +286,7 @@ static int handle_cache(const char *path, unsigned char *sha1, const char *outpu
 	struct cache_entry *ce;
 	int pos, len, i, hunk_no;
 	struct rerere_io_mem io;
-	int marker_size = 7;
+	int marker_size = ll_merge_marker_size(path);
 
 	/*
 	 * Reproduce the conflicted merge in-core
-- 
1.6.6.405.g80ed6.dirty
Previous: Junio C HamanoNext: Junio C Hamano
Message 12 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.