Skip to content

Commit b8e9467

Browse files
committed
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.
1 parent 45f5840 commit b8e9467

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/git2/merge.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ typedef enum {
162162
GIT_MERGE_FILE_DIFF_MINIMAL = (1 << 7),
163163
} git_merge_file_flag_t;
164164

165+
#define GIT_MERGE_CONFLICT_MARKER_SIZE 7
166+
165167
/**
166168
* Options for merging a file
167169
*/
@@ -191,6 +193,10 @@ typedef struct {
191193

192194
/** see `git_merge_file_flag_t` above */
193195
git_merge_file_flag_t flags;
196+
197+
/** The size of conflict markers (eg, "<<<<<<<"). Default is
198+
* GIT_MERGE_CONFLICT_MARKER_SIZE. */
199+
unsigned short marker_size;
194200
} git_merge_file_options;
195201

196202
#define GIT_MERGE_FILE_OPTIONS_VERSION 1

src/merge_file.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ static int merge_file__xdiff(
126126
if (options.flags & GIT_MERGE_FILE_DIFF_MINIMAL)
127127
xmparam.xpp.flags |= XDF_NEED_MINIMAL;
128128

129+
xmparam.marker_size = options.marker_size;
130+
129131
if ((xdl_result = xdl_merge(&ancestor_mmfile, &our_mmfile,
130132
&their_mmfile, &xmparam, &mmbuffer)) < 0) {
131133
giterr_set(GITERR_MERGE, "failed to merge files");

0 commit comments

Comments
 (0)