Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xdiff
diff options
context:
space:
mode:
Diffstat (limited to 'xdiff')
-rw-r--r--xdiff/xdiff.h8
-rw-r--r--xdiff/xmerge.c9
2 files changed, 14 insertions, 3 deletions
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index 22f3913427..3f6229edbe 100644
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
@@ -58,6 +58,12 @@ extern "C" {
#define XDL_MERGE_ZEALOUS_ALNUM 3
#define XDL_MERGE_LEVEL_MASK 0x0f
+/* merge favor modes */
+#define XDL_MERGE_FAVOR_OURS 1
+#define XDL_MERGE_FAVOR_THEIRS 2
+#define XDL_MERGE_FAVOR(flags) (((flags)>>4) & 3)
+#define XDL_MERGE_FLAGS(level, style, favor) ((level)|(style)|((favor)<<4))
+
/* merge output styles */
#define XDL_MERGE_DIFF3 0x8000
#define XDL_MERGE_STYLE_MASK 0x8000
@@ -117,7 +123,7 @@ typedef struct s_xmparam {
int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
mmfile_t *mf2, const char *name2,
- xmparam_t const *xmp, int level, mmbuffer_t *result);
+ xmparam_t const *xmp, int flags, mmbuffer_t *result);
#ifdef __cplusplus
}
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index 68c815f9d3..8cbe45e675 100644
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
@@ -216,12 +216,16 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1,
static int xdl_fill_merge_buffer(xdfenv_t *xe1, const char *name1,
xdfenv_t *xe2, const char *name2,
+ int favor,
xdmerge_t *m, char *dest, int style,
int marker_size)
{
int size, i;
for (size = i = 0; m; m = m->next) {
+ if (favor && !m->mode)
+ m->mode = favor;
+
if (m->mode == 0)
size = fill_conflict_hunk(xe1, name1, xe2, name2,
size, i, style, m, dest,
@@ -396,6 +400,7 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,
int i0, i1, i2, chg0, chg1, chg2;
int level = flags & XDL_MERGE_LEVEL_MASK;
int style = flags & XDL_MERGE_STYLE_MASK;
+ int favor = XDL_MERGE_FAVOR(flags);
if (style == XDL_MERGE_DIFF3) {
/*
@@ -529,7 +534,7 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,
if (result) {
int marker_size = xmp->marker_size;
int size = xdl_fill_merge_buffer(xe1, name1, xe2, name2,
- changes, NULL, style,
+ favor, changes, NULL, style,
marker_size);
result->ptr = xdl_malloc(size);
if (!result->ptr) {
@@ -537,7 +542,7 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,
return -1;
}
result->size = size;
- xdl_fill_merge_buffer(xe1, name1, xe2, name2, changes,
+ xdl_fill_merge_buffer(xe1, name1, xe2, name2, favor, changes,
result->ptr, style, marker_size);
}
return xdl_cleanup_merge(changes);