summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorAvery Pennarun <apenwarr@gmail.com>2009-11-25 21:23:55 -0500
committerJunio C Hamano <gitster@pobox.com>2010-01-17 22:45:06 -0800
commit8cc5b29065e19267cbc08b39c34674b02c2e3d59 (patch)
treea7fc209fac5df7d2a9c9a5795fb4f58746ae3840 /merge-recursive.c
parent73eb40eeaaebc5ebae283c06286b96b4aea00143 (diff)
downloadgit-8cc5b29065e19267cbc08b39c34674b02c2e3d59.tar.gz
git merge -X<option>
Teach "-X <option>" command line argument to "git merge" that is passed to strategy implementations. "ours" and "theirs" autoresolution introduced by the previous commit can be asked to the recursive strategy. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index a91208f295..82f24ac16e 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -642,6 +642,23 @@ static int merge_3way(struct merge_options *o,
mmfile_t orig, src1, src2;
char *name1, *name2;
int merge_status;
+ int favor;
+
+ if (o->call_depth)
+ favor = 0;
+ else {
+ switch (o->recursive_variant) {
+ case MERGE_RECURSIVE_OURS:
+ favor = XDL_MERGE_FAVOR_OURS;
+ break;
+ case MERGE_RECURSIVE_THEIRS:
+ favor = XDL_MERGE_FAVOR_THEIRS;
+ break;
+ default:
+ favor = 0;
+ break;
+ }
+ }
if (strcmp(a->path, b->path)) {
name1 = xstrdup(mkpath("%s:%s", branch1, a->path));
@@ -657,7 +674,7 @@ static int merge_3way(struct merge_options *o,
merge_status = ll_merge(result_buf, a->path, &orig,
&src1, name1, &src2, name2,
- o->call_depth);
+ (!!o->call_depth) | (favor << 1));
free(name1);
free(name2);
@@ -1196,7 +1213,7 @@ int merge_trees(struct merge_options *o,
{
int code, clean;
- if (o->subtree_merge) {
+ if (o->recursive_variant == MERGE_RECURSIVE_SUBTREE) {
merge = shift_tree_object(head, merge);
common = shift_tree_object(head, common);
}