summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-01-20 19:39:34 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2018-01-21 11:18:25 +0000
commitb8e9467a4b7f76c711103c9722deaf8c828d9abc (patch)
tree73bb7c683f838b195568680b388d0b870c8f604f
parent45f584090818c59ba27ca95b1e930a41c424d6f1 (diff)
downloadlibgit2-b8e9467a4b7f76c711103c9722deaf8c828d9abc.tar.gz
merge: allow custom conflict marker size
Allow for a custom conflict marker size, allowing callers to override the default size of the "<<<<<<<" and ">>>>>>>" markers in the conflicted output file.
-rw-r--r--include/git2/merge.h6
-rw-r--r--src/merge_file.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/include/git2/merge.h b/include/git2/merge.h
index 94ac8b5c5..80ef864d1 100644
--- a/include/git2/merge.h
+++ b/include/git2/merge.h
@@ -162,6 +162,8 @@ typedef enum {
GIT_MERGE_FILE_DIFF_MINIMAL = (1 << 7),
} git_merge_file_flag_t;
+#define GIT_MERGE_CONFLICT_MARKER_SIZE 7
+
/**
* Options for merging a file
*/
@@ -191,6 +193,10 @@ typedef struct {
/** see `git_merge_file_flag_t` above */
git_merge_file_flag_t flags;
+
+ /** The size of conflict markers (eg, "<<<<<<<"). Default is
+ * GIT_MERGE_CONFLICT_MARKER_SIZE. */
+ unsigned short marker_size;
} git_merge_file_options;
#define GIT_MERGE_FILE_OPTIONS_VERSION 1
diff --git a/src/merge_file.c b/src/merge_file.c
index a54d6bd57..a36c1986c 100644
--- a/src/merge_file.c
+++ b/src/merge_file.c
@@ -126,6 +126,8 @@ static int merge_file__xdiff(
if (options.flags & GIT_MERGE_FILE_DIFF_MINIMAL)
xmparam.xpp.flags |= XDF_NEED_MINIMAL;
+ xmparam.marker_size = options.marker_size;
+
if ((xdl_result = xdl_merge(&ancestor_mmfile, &our_mmfile,
&their_mmfile, &xmparam, &mmbuffer)) < 0) {
giterr_set(GITERR_MERGE, "failed to merge files");