summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-18 19:18:25 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-04-18 19:30:49 (GMT)
commit3086486d326b00ce308208e62e0e0de831f3563b (patch)
tree2ee15108e631a05b91c3a1ec7da75fd7a780c3d0 /merge-recursive.c
parent153920da5b62024c0aceef23252b82ad18e5fe22 (diff)
downloadgit-3086486d326b00ce308208e62e0e0de831f3563b.zip
git-3086486d326b00ce308208e62e0e0de831f3563b.tar.gz
git-3086486d326b00ce308208e62e0e0de831f3563b.tar.bz2
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>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 0f5c28e..7b5ca8e 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);