summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a16143)
raw | patch | inline | side by side (parent: 8a16143)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Sun, 21 Mar 2010 00:35:18 +0000 (19:35 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 21 Mar 2010 03:36:10 +0000 (20:36 -0700) |
The labels for the three participants in a potential conflict are all
optional arguments for the xdiff merge routine; if they are NULL, then
xdl_merge() can cope by omitting the labels from its output. Move
them to the xmparam structure to allow new callers to save some
keystrokes where they are not needed.
This also has the virtue of making the xdiff merge interface more
similar to merge_trees, which might make it easier to learn.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
optional arguments for the xdiff merge routine; if they are NULL, then
xdl_merge() can cope by omitting the labels from its output. Move
them to the xmparam structure to allow new callers to save some
keystrokes where they are not needed.
This also has the virtue of making the xdiff merge interface more
similar to merge_trees, which might make it easier to learn.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge-file.c | patch | blob | history | |
ll-merge.c | patch | blob | history | |
xdiff/xdiff.h | patch | blob | history | |
xdiff/xmerge.c | patch | blob | history |
diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index 69cc683332a04ddc6959fcef3d2853ccfb2860b8..65eb790fd0ac0cf5c7c267aacd521a632ac73a0c 100644 (file)
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
argv[i]);
}
- ret = xdl_merge(mmfs + 1, mmfs + 0, names[0], mmfs + 2, names[2],
- &xmp, &result);
+ xmp.file1 = names[0];
+ xmp.file2 = names[2];
+ ret = xdl_merge(mmfs + 1, mmfs + 0, mmfs + 2, &xmp, &result);
for (i = 0; i < 3; i++)
free(mmfs[i].ptr);
diff --git a/ll-merge.c b/ll-merge.c
index 82c7742e41f4645e7d6086bb277437a84ff4f03b..184948d6015629e6b0c45e02ee792d5d6c49ef1a 100644 (file)
--- a/ll-merge.c
+++ b/ll-merge.c
xmp.style = git_xmerge_style;
if (marker_size > 0)
xmp.marker_size = marker_size;
- return xdl_merge(orig, src1, name1, src2, name2, &xmp, result);
+ xmp.file1 = name1;
+ xmp.file2 = name2;
+ return xdl_merge(orig, src1, src2, &xmp, result);
}
static int ll_union_merge(const struct ll_merge_driver *drv_unused,
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index 6eb5fffde128d4503fcb33fc8d1e71ac67fc1a8f..711048ea36dda1d814b395efa8bc69ab142425ca 100644 (file)
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
int favor;
int style;
const char *ancestor; /* label for orig */
+ const char *file1; /* label for mf1 */
+ const char *file2; /* label for mf2 */
} xmparam_t;
#define DEFAULT_CONFLICT_MARKER_SIZE 7
-int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
- mmfile_t *mf2, const char *name2,
+int xdl_merge(mmfile_t *orig, mmfile_t *mf1, mmfile_t *mf2,
xmparam_t const *xmp, mmbuffer_t *result);
#ifdef __cplusplus
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index 9fc80ad3891f93617ed77308026808c4601a542e..16dd9acd37b431f1e439d9ab051fe2436c54b45c 100644 (file)
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
*
* returns < 0 on error, == 0 for no conflicts, else number of conflicts
*/
-static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,
- xdfenv_t *xe2, xdchange_t *xscr2, const char *name2,
- xmparam_t const *xmp, mmbuffer_t *result) {
+static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1,
+ xdfenv_t *xe2, xdchange_t *xscr2,
+ xmparam_t const *xmp, mmbuffer_t *result)
+{
xdmerge_t *changes, *c;
xpparam_t const *xpp = &xmp->xpp;
const char *const ancestor_name = xmp->ancestor;
+ const char *const name1 = xmp->file1;
+ const char *const name2 = xmp->file2;
int i0, i1, i2, chg0, chg1, chg2;
int level = xmp->level;
int style = xmp->style;
return xdl_cleanup_merge(changes);
}
-int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
- mmfile_t *mf2, const char *name2,
- xmparam_t const *xmp, mmbuffer_t *result) {
+int xdl_merge(mmfile_t *orig, mmfile_t *mf1, mmfile_t *mf2,
+ xmparam_t const *xmp, mmbuffer_t *result)
+{
xdchange_t *xscr1, *xscr2;
xdfenv_t xe1, xe2;
int status;
memcpy(result->ptr, mf1->ptr, mf1->size);
result->size = mf1->size;
} else {
- status = xdl_do_merge(&xe1, xscr1, name1,
- &xe2, xscr2, name2,
+ status = xdl_do_merge(&xe1, xscr1,
+ &xe2, xscr2,
xmp, result);
}
xdl_free_script(xscr1);