@matheusbsbs / matheus-bagliano / commits / c236bcd061
Fork 0

git-merge-recursive: learn to honor merge.conflictstyle

This teaches the low-level ll_xdl_merge() routine to honor merge.conflictstyle configuration variable, so that merge-recursive strategy can show the conflicts in the style of user's choice. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 29, 2008 at 10:59 UTC c236bcd06138bcbc929b86ad1a513635bf4847b2
2 files changed +14 -6
builtin-merge-recursive.c
+1 -1
@@ -1348,7 +1348,7 @@ static int merge_config(const char *var, const char *value, void *cb)
1348 merge_rename_limit = git_config_int(var, value);
1349 return 0;
1350 }
1351 - return git_default_config(var, value, cb);
1351 + return git_xmerge_config(var, value, cb);
1352 }
1353
1354 int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
ll-merge.c
+13 -5
@@ -63,6 +63,7 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
63 int virtual_ancestor)
64 {
65 xpparam_t xpp;
66 + int style = 0;
67
68 if (buffer_is_binary(orig->ptr, orig->size) ||
69 buffer_is_binary(src1->ptr, src1->size) ||
@@ -77,10 +78,12 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
78 }
79
80 memset(&xpp, 0, sizeof(xpp));
81 + if (git_xmerge_style >= 0)
82 + style = git_xmerge_style;
83 return xdl_merge(orig,
84 src1, name1,
85 src2, name2,
83 - &xpp, XDL_MERGE_ZEALOUS,
86 + &xpp, XDL_MERGE_ZEALOUS | style,
87 result);
88 }
89
@@ -95,10 +98,15 @@ static int ll_union_merge(const struct ll_merge_driver *drv_unused,
98 char *src, *dst;
99 long size;
100 const int marker_size = 7;
98 -
99 - int status = ll_xdl_merge(drv_unused, result, path_unused,
100 - orig, src1, NULL, src2, NULL,
101 - virtual_ancestor);
101 + int status, saved_style;
102 +
103 + /* We have to force the RCS "merge" style */
104 + saved_style = git_xmerge_style;
105 + git_xmerge_style = 0;
106 + status = ll_xdl_merge(drv_unused, result, path_unused,
107 + orig, src1, NULL, src2, NULL,
108 + virtual_ancestor);
109 + git_xmerge_style = saved_style;
110 if (status <= 0)
111 return status;
112 size = result->size;