From: Jeff King <peff@peff.net>
To: David Krmpotic <david.krmpotic@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: auto merge bug
Date: Tue, 5 Mar 2013 04:12:03 -0500 [thread overview]
Message-ID: <20130305091203.GD13552@sigill.intra.peff.net> (raw)
In-Reply-To: <20130305090326.GC13552@sigill.intra.peff.net>
On Tue, Mar 05, 2013 at 04:03:26AM -0500, Jeff King wrote:
> You might be able to get by with a version of the "union" driver that
> asks the 3-way merge driver to be less aggressive about shrinking the
> conflict blocks. For example, with this patch to git:
>
> diff --git a/ll-merge.c b/ll-merge.c
> index fb61ea6..61b1d4e 100644
> --- a/ll-merge.c
> +++ b/ll-merge.c
> @@ -100,7 +100,6 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
> }
>
> memset(&xmp, 0, sizeof(xmp));
> - xmp.level = XDL_MERGE_ZEALOUS;
> xmp.favor = opts->variant;
> xmp.xpp.flags = opts->xdl_opts;
> if (git_xmerge_style >= 0)
>
> I think the merge will produce the results you are looking for. This
> would have to be configurable, though, as it is a regression for
> existing users of "union", which would want the duplicate-line
> suppression (or maybe not; it will only catch such duplicates at the
> beginning and end of the conflict hunk, so maybe it is sane to always
> ask "union" to keep all lines).
Here's what the patch would look like to make it non-configurable, but
to just trigger for the "union" case:
diff --git a/ll-merge.c b/ll-merge.c
index fb61ea6..fc33a23 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -83,7 +83,8 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
mmfile_t *src1, const char *name1,
mmfile_t *src2, const char *name2,
const struct ll_merge_options *opts,
- int marker_size)
+ int marker_size,
+ int level)
{
xmparam_t xmp;
assert(opts);
@@ -100,7 +101,7 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
}
memset(&xmp, 0, sizeof(xmp));
- xmp.level = XDL_MERGE_ZEALOUS;
+ xmp.level = level;
xmp.favor = opts->variant;
xmp.xpp.flags = opts->xdl_opts;
if (git_xmerge_style >= 0)
@@ -129,7 +130,23 @@ static int ll_union_merge(const struct ll_merge_driver *drv_unused,
o.variant = XDL_MERGE_FAVOR_UNION;
return ll_xdl_merge(drv_unused, result, path_unused,
orig, NULL, src1, NULL, src2, NULL,
- &o, marker_size);
+ &o, marker_size, XDL_MERGE_MINIMAL);
+}
+
+static int ll_text_merge(const struct ll_merge_driver *drv,
+ mmbuffer_t *result,
+ const char *path,
+ mmfile_t *orig, const char *orig_name,
+ mmfile_t *src1, const char *name1,
+ mmfile_t *src2, const char *name2,
+ const struct ll_merge_options *opts,
+ int marker_size)
+{
+ return ll_xdl_merge(drv, result, path,
+ orig, orig_name,
+ src1, name1,
+ src2, name2,
+ opts, marker_size, XDL_MERGE_ZEALOUS);
}
#define LL_BINARY_MERGE 0
@@ -137,7 +154,7 @@ static struct ll_merge_driver ll_merge_drv[] = {
#define LL_UNION_MERGE 2
static struct ll_merge_driver ll_merge_drv[] = {
{ "binary", "built-in binary merge", ll_binary_merge },
- { "text", "built-in 3-way text merge", ll_xdl_merge },
+ { "text", "built-in 3-way text merge", ll_text_merge },
{ "union", "built-in union merge", ll_union_merge },
};
next prev parent reply other threads:[~2013-03-05 9:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-04 16:46 auto merge bug David Krmpotic
2013-03-05 9:03 ` Jeff King
2013-03-05 9:12 ` Jeff King [this message]
2013-03-05 15:44 ` Junio C Hamano
2013-03-05 17:59 ` Jeff King
2013-03-05 18:47 ` Junio C Hamano
2013-03-05 20:56 ` Andreas Ericsson
[not found] ` <194F685F-9460-42C6-B5A5-59475F53D038@gmail.com>
2013-03-05 22:13 ` David Krmpotic
2013-03-06 9:15 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130305091203.GD13552@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=david.krmpotic@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).