git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 8/8] rerere: honor conflict-marker-size attribute
Date: Sun, 17 Jan 2010 01:39:04 -0800	[thread overview]
Message-ID: <1263721144-18605-9-git-send-email-gitster@pobox.com> (raw)
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

  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 ` [PATCH 4/8] merge-tree: use ll_merge() not xdl_merge() Junio C Hamano
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 ` Junio C Hamano [this message]
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-9-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.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).