git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Waitz <tali@admingilde.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org
Subject: Re: [PATCH 0/2] Custom low-level merge driver support.
Date: Wed, 18 Apr 2007 12:23:43 -0700	[thread overview]
Message-ID: <7vslaxfpvk.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7vzm55fqyv.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Wed, 18 Apr 2007 12:00:08 -0700")

Junio C Hamano <junkio@cox.net> writes:

> Linus Torvalds <torvalds@linux-foundation.org> writes:
>
>> For example, for a three-way merge, it makes sense to do the three-way 
>> merge for the "internal" merge too. But it might be that that isn't true 
>> for all strategies.
>
> Yes, that is what I alluded to in one of my previous message,
> but I think the "foo-recursive" idea is a good one.  I was
> planning to give only "3-way" or "pick ancestor" choice to
> external low-level merge drivers.
>
> But I think that is a separate issue.

The syntax is a bit different from the one you came up in your
MUA.

	# a recursive merge will always just pick the ORIGINAL
	# version of a file when blending - the blending will
	# be done only on the final merge
	[merge "blend"]
		name = blend (changelog) strategy
		driver = blend %A %O %B
		recursive = binary

The variable merge.<<drivername>>.recursive names a different
low level merge driver to be used while performing the virtual
ancestor merge.  In this example, the built-in "binary" merge
which picks 'ours' for the final round and 'origin' for the
internal merge already does what we want.

-- >8 --
[PATCH] Allow low-level driver to specify different behaviour during internal merge.

This allows [merge "drivername"] to have a variable "recursive"
that names a different low-level merge driver to be used when
merging common ancestors to come up with a virtual ancestor.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 merge-recursive.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index 4af69d7..43d6117 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -677,6 +677,7 @@ struct ll_merge_driver {
 	const char *name;
 	const char *description;
 	ll_merge_fn fn;
+	const char *recursive;
 	struct ll_merge_driver *next;
 	char *cmdline;
 };
@@ -934,6 +935,13 @@ static int read_merge_config(const char *var, const char *value)
 		return 0;
 	}
 
+	if (!strcmp("recursive", ep)) {
+		if (!value)
+			return error("%s: lacks value", var);
+		fn->recursive = strdup(value);
+		return 0;
+	}
+
 	return 0;
 }
 
@@ -1013,6 +1021,10 @@ static int ll_merge(mmbuffer_t *result_buf,
 	merge_attr = git_path_check_merge(a->path);
 	driver = find_ll_merge_driver(merge_attr);
 
+	if (index_only && driver->recursive) {
+		merge_attr = git_attr(driver->recursive, strlen(driver->recursive));
+		driver = find_ll_merge_driver(merge_attr);
+	}
 	merge_status = driver->fn(driver, a->path,
 				  &orig, &src1, name1, &src2, name2,
 				  result_buf);
-- 
1.5.1.1.905.g4cad0

  reply	other threads:[~2007-04-18 19:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18  9:21 [PATCH 0/2] Custom low-level merge driver support Junio C Hamano
2007-04-18  9:21 ` [PATCH 1/2] " Junio C Hamano
2007-04-18 10:36   ` Johannes Sixt
2007-04-18 10:55     ` Johannes Schindelin
2007-04-18  9:21 ` [PATCH 2/2] Allow the default low-level merge driver to be configured Junio C Hamano
2007-04-18 10:48 ` [PATCH 0/2] Custom low-level merge driver support Johannes Schindelin
2007-04-18 15:34   ` Martin Waitz
2007-04-18 15:56     ` Junio C Hamano
2007-04-18 16:08       ` Martin Waitz
2007-04-18 16:16     ` Linus Torvalds
2007-04-18 17:10       ` Junio C Hamano
2007-04-18 18:45         ` Linus Torvalds
2007-04-18 19:00           ` Junio C Hamano
2007-04-18 19:23             ` Junio C Hamano [this message]
2007-04-18 19:43               ` Linus Torvalds
2007-04-18 19:51             ` Linus Torvalds
2007-04-18 20:13               ` Junio C Hamano
2007-04-18 20:35                 ` Linus Torvalds
2007-04-18 20:09                   ` David Lang
2007-04-18 21:01                     ` Junio C Hamano
2007-04-19  7:52                   ` Martin Waitz
2007-04-19  8:08                     ` Junio C Hamano
2007-04-18 18:28       ` [PATCH] Custom low-level merge driver: change the configuration scheme Junio C Hamano

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=7vslaxfpvk.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=tali@admingilde.org \
    --cc=torvalds@linux-foundation.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).