summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-08-26 00:49:53 -0500
committerJunio C Hamano <gitster@pobox.com>2010-08-26 09:18:51 -0700
commit712516bcacacd45b4825ec649f15c3573f6fb42a (patch)
treed167bb0edd73ead266dad5914a2d1d49276cf4f0 /merge-recursive.c
parent635a7bb1d807390bedfc1147d2052e8423bcd1e0 (diff)
downloadgit-712516bcacacd45b4825ec649f15c3573f6fb42a.tar.gz
ll-merge: replace flag argument with options struct
Keeping track of the flag bits is proving more trouble than it's worth. Instead, use a pointer to an options struct like most similar APIs do. Callers with no special requests can pass NULL to request the default options. Cc: Bert Wesarg <bert.wesarg@googlemail.com> Cc: Avery Pennarun <apenwarr@gmail.com> Helped-by: Justin Frankel <justin@cockos.com> Helped-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 44576b7927..0e9a29d329 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -608,22 +608,25 @@ static int merge_3way(struct merge_options *o,
const char *branch2)
{
mmfile_t orig, src1, src2;
+ struct ll_merge_options ll_opts = {0};
char *base_name, *name1, *name2;
int merge_status;
- int favor;
- if (o->call_depth)
- favor = 0;
- else {
+ ll_opts.renormalize = o->renormalize;
+
+ if (o->call_depth) {
+ ll_opts.virtual_ancestor = 1;
+ ll_opts.variant = 0;
+ } else {
switch (o->recursive_variant) {
case MERGE_RECURSIVE_OURS:
- favor = XDL_MERGE_FAVOR_OURS;
+ ll_opts.variant = XDL_MERGE_FAVOR_OURS;
break;
case MERGE_RECURSIVE_THEIRS:
- favor = XDL_MERGE_FAVOR_THEIRS;
+ ll_opts.variant = XDL_MERGE_FAVOR_THEIRS;
break;
default:
- favor = 0;
+ ll_opts.variant = 0;
break;
}
}
@@ -646,10 +649,7 @@ static int merge_3way(struct merge_options *o,
read_mmblob(&src2, b->sha1);
merge_status = ll_merge(result_buf, a->path, &orig, base_name,
- &src1, name1, &src2, name2,
- ((o->call_depth ? LL_OPT_VIRTUAL_ANCESTOR : 0) |
- (o->renormalize ? LL_OPT_RENORMALIZE : 0) |
- create_ll_flag(favor)));
+ &src1, name1, &src2, name2, &ll_opts);
free(name1);
free(name2);