git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH 2/2] Allow the default low-level merge driver to be configured.
Date: Wed, 18 Apr 2007 02:21:02 -0700	[thread overview]
Message-ID: <1176888062910-git-send-email-junkio@cox.net> (raw)
In-Reply-To: <11768880622402-git-send-email-junkio@cox.net>

When no 'merge' attribute is given to a path, merge-recursive
uses the built-in xdl-merge as the low-level merge driver.

A new configuration item 'merge.default' can name a low-level
merge driver of user's choice to be used instead.

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

diff --git a/merge-recursive.c b/merge-recursive.c
index 8ec18ad..5983000 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -839,12 +839,18 @@ static struct user_merge_fn {
 	char *cmdline;
 	char b_[1];
 } *ll_user_merge_fns, **ll_user_merge_fns_tail;
+static const char *default_ll_merge;
 
 static int read_merge_config(const char *var, const char *value)
 {
 	struct user_merge_fn *fn;
 	int blen, nlen;
 
+	if (!strcmp(var, "merge.default")) {
+		default_ll_merge = strdup(value);
+		return 0;
+	}
+
 	if (strcmp(var, "merge.driver"))
 		return 0;
 	if (!value)
@@ -900,8 +906,12 @@ static ll_merge_fn find_ll_merge_fn(void *merge_attr, const char **cmdline)
 		return ll_xdl_merge;
 	else if (ATTR_FALSE(merge_attr))
 		return ll_binary_merge;
-	else if (ATTR_UNSET(merge_attr))
-		return ll_xdl_merge;
+	else if (ATTR_UNSET(merge_attr)) {
+		if (!default_ll_merge)
+			return ll_xdl_merge;
+		else
+			name = default_ll_merge;
+	}
 	else
 		name = merge_attr;
 
-- 
1.5.1.1.901.g25ba

  parent reply	other threads:[~2007-04-18  9:21 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 ` Junio C Hamano [this message]
2007-04-18 10:48 ` [PATCH 0/2] " 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
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=1176888062910-git-send-email-junkio@cox.net \
    --to=junkio@cox.net \
    --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).