aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-16 23:28:46 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-17 02:01:43 -0800
commit8588567c96490b8d236b1bc13f9bcb0dfa118efe (patch)
tree5c5f026346ef69293b14419028f15ecf39d5701d
parent191f24171718e894cb5ba806bc45861ebac95e96 (diff)
downloadgit-8588567c96490b8d236b1bc13f9bcb0dfa118efe.tar.gz
git-8588567c96490b8d236b1bc13f9bcb0dfa118efe.tar.xz
rerere: honor conflict-marker-size attribute
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--ll-merge.c15
-rw-r--r--ll-merge.h2
-rw-r--r--rerere.c5
3 files changed, 20 insertions, 2 deletions
diff --git a/ll-merge.c b/ll-merge.c
index d6820714d..0dcaae0dd 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 5388422d0..ff5d84a34 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 5f332cb25..b988b467f 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;
@@ -221,7 +222,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;
@@ -288,7 +289,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