summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4bb0936)
raw | patch | inline | side by side (parent: 4bb0936)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Sun, 21 Mar 2010 00:38:58 +0000 (19:38 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 21 Mar 2010 03:36:11 +0000 (20:36 -0700) |
Commands using the ll_merge() function will present conflict hunks
imitating ‘diff3 -m’ output if the merge.conflictstyle configuration
option is set appropriately. Unlike ‘diff3 -m’, the output does not
include a label for the merge base on the ||||||| line of the output,
and some tools misparse the conflict hunks without that.
Add a new ancestor_label parameter to ll_merge() to give callers the
power to rectify this situation. If ancestor_label is NULL, the output
format is unchanged. All callers pass NULL for now.
Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
imitating ‘diff3 -m’ output if the merge.conflictstyle configuration
option is set appropriately. Unlike ‘diff3 -m’, the output does not
include a label for the merge base on the ||||||| line of the output,
and some tools misparse the conflict hunks without that.
Add a new ancestor_label parameter to ll_merge() to give callers the
power to rectify this situation. If ancestor_label is NULL, the output
format is unchanged. All callers pass NULL for now.
Requested-by: Stefan Monnier <monnier@iro.umontreal.ca>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c | patch | blob | history | |
ll-merge.c | patch | blob | history | |
ll-merge.h | patch | blob | history | |
merge-file.c | patch | blob | history | |
merge-recursive.c | patch | blob | history | |
rerere.c | patch | blob | history |
diff --git a/builtin/checkout.c b/builtin/checkout.c
index acefaaf41a4e26e45225f6d228734c93c8f2b23c..d67f809a9ca150e9ca523013725044f3ef7ef8db 100644 (file)
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
read_mmblob(&ours, active_cache[pos+1]->sha1);
read_mmblob(&theirs, active_cache[pos+2]->sha1);
- status = ll_merge(&result_buf, path, &ancestor,
+ status = ll_merge(&result_buf, path, &ancestor, NULL,
&ours, "ours", &theirs, "theirs", 0);
free(ancestor.ptr);
free(ours.ptr);
diff --git a/ll-merge.c b/ll-merge.c
index 184948d6015629e6b0c45e02ee792d5d6c49ef1a..f9b3d854a921ab6fa3eed6f4dbf01af1a8657602 100644 (file)
--- a/ll-merge.c
+++ b/ll-merge.c
typedef int (*ll_merge_fn)(const struct ll_merge_driver *,
mmbuffer_t *result,
const char *path,
- mmfile_t *orig,
+ mmfile_t *orig, const char *orig_name,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
int flag,
static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
mmbuffer_t *result,
const char *path_unused,
- mmfile_t *orig,
+ mmfile_t *orig, const char *orig_name,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
int flag, int marker_size)
static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
mmbuffer_t *result,
const char *path,
- mmfile_t *orig,
+ mmfile_t *orig, const char *orig_name,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
int flag, int marker_size)
path, name1, name2);
return ll_binary_merge(drv_unused, result,
path,
- orig, src1, name1,
+ orig, orig_name,
+ src1, name1,
src2, name2,
flag, marker_size);
}
xmp.style = git_xmerge_style;
if (marker_size > 0)
xmp.marker_size = marker_size;
+ xmp.ancestor = orig_name;
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,
mmbuffer_t *result,
const char *path_unused,
- mmfile_t *orig,
+ mmfile_t *orig, const char *orig_name,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
int flag, int marker_size)
/* Use union favor */
flag = (flag & 1) | (XDL_MERGE_FAVOR_UNION << 1);
return ll_xdl_merge(drv_unused, result, path_unused,
- orig, src1, NULL, src2, NULL,
+ orig, NULL, src1, NULL, src2, NULL,
flag, marker_size);
return 0;
}
static int ll_ext_merge(const struct ll_merge_driver *fn,
mmbuffer_t *result,
const char *path,
- mmfile_t *orig,
+ mmfile_t *orig, const char *orig_name,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
int flag, int marker_size)
@@ -321,7 +323,7 @@ static int git_path_check_merge(const char *path, struct git_attr_check check[2]
int ll_merge(mmbuffer_t *result_buf,
const char *path,
- mmfile_t *ancestor,
+ mmfile_t *ancestor, const char *ancestor_label,
mmfile_t *ours, const char *our_label,
mmfile_t *theirs, const char *their_label,
int flag)
driver = find_ll_merge_driver(ll_driver_name);
if (virtual_ancestor && driver->recursive)
driver = find_ll_merge_driver(driver->recursive);
- return driver->fn(driver, result_buf, path, ancestor,
+ return driver->fn(driver, result_buf, path, ancestor, ancestor_label,
ours, our_label, theirs, their_label,
flag, marker_size);
}
diff --git a/ll-merge.h b/ll-merge.h
index 57889227b1782d3792be2046fbb54bca67b779de..57754cc8ca7b378a86b168a4fd6299fa3dfba045 100644 (file)
--- a/ll-merge.h
+++ b/ll-merge.h
int ll_merge(mmbuffer_t *result_buf,
const char *path,
- mmfile_t *ancestor,
+ mmfile_t *ancestor, const char *ancestor_label,
mmfile_t *ours, const char *our_label,
mmfile_t *theirs, const char *their_label,
int flag);
diff --git a/merge-file.c b/merge-file.c
index fd34d76e1516b2c944778a11a5670d382f245873..07cc0c9053b7784249e2e34f90ac6e64c878a66e 100644 (file)
--- a/merge-file.c
+++ b/merge-file.c
int merge_status;
mmbuffer_t res;
- merge_status = ll_merge(&res, path, base,
+ merge_status = ll_merge(&res, path, base, NULL,
our, ".our", their, ".their", 0);
if (merge_status < 0)
return NULL;
diff --git a/merge-recursive.c b/merge-recursive.c
index 195ebf974435b0b08cd2be0f54c137218034008b..3b2cc9d15a939eb29913f7e8a49149b17592f9cc 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
read_mmblob(&src1, a->sha1);
read_mmblob(&src2, b->sha1);
- merge_status = ll_merge(result_buf, a->path, &orig,
+ merge_status = ll_merge(result_buf, a->path, &orig, NULL,
&src1, name1, &src2, name2,
(!!o->call_depth) | (favor << 1));
diff --git a/rerere.c b/rerere.c
index a59f74f76c293efa783103eaf3d167c97b3768ea..f221bed1e97a0f1b41d1845edac270a109e3a4dd 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -319,7 +319,7 @@ static int handle_cache(const char *path, unsigned char *sha1, const char *outpu
if (!mmfile[i].ptr && !mmfile[i].size)
mmfile[i].ptr = xstrdup("");
}
- ll_merge(&result, path, &mmfile[0],
+ ll_merge(&result, path, &mmfile[0], NULL,
&mmfile[1], "ours",
&mmfile[2], "theirs", 0);
for (i = 0; i < 3; i++)
ret = 1;
goto out;
}
- ret = ll_merge(&result, path, &base, &cur, "", &other, "", 0);
+ ret = ll_merge(&result, path, &base, NULL, &cur, "", &other, "", 0);
if (!ret) {
FILE *f = fopen(path, "w");
if (!f)