summaryrefslogtreecommitdiff
path: root/xdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-03-21 00:35:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-03-21 03:36:10 (GMT)
commita4b5e91c49238146f4cb85ff5f7f3bc97e0e51de (patch)
tree3870b41f8a7cd493288400d14657db961e409fe4 /xdiff
parent8a161433a0b414d15093e312eb9be99587074309 (diff)
downloadgit-a4b5e91c49238146f4cb85ff5f7f3bc97e0e51de.zip
git-a4b5e91c49238146f4cb85ff5f7f3bc97e0e51de.tar.gz
git-a4b5e91c49238146f4cb85ff5f7f3bc97e0e51de.tar.bz2
xdl_merge(): move file1 and file2 labels to xmparam structure
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>
Diffstat (limited to 'xdiff')
-rw-r--r--xdiff/xdiff.h5
-rw-r--r--xdiff/xmerge.c19
2 files changed, 14 insertions, 10 deletions
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index 6eb5fff..711048e 100644
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
@@ -118,12 +118,13 @@ typedef struct s_xmparam {
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 9fc80ad..16dd9ac 100644
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
@@ -407,12 +407,15 @@ static int xdl_simplify_non_conflicts(xdfenv_t *xe1, xdmerge_t *m,
*
* 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;
@@ -566,9 +569,9 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,
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;
@@ -603,8 +606,8 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
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);