summaryrefslogtreecommitdiff
path: root/builtin-merge-recursive.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-merge-recursive.c')
-rw-r--r--builtin-merge-recursive.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/builtin-merge-recursive.c b/builtin-merge-recursive.c
index 5c7fbb2599..910c0d20e7 100644
--- a/builtin-merge-recursive.c
+++ b/builtin-merge-recursive.c
@@ -668,9 +668,20 @@ static struct merge_file_info merge_file(struct diff_filespec *o,
if (!sha_eq(a->sha1, o->sha1) && !sha_eq(b->sha1, o->sha1))
result.merge = 1;
- result.mode = a->mode == o->mode ? b->mode: a->mode;
+ /*
+ * Merge modes
+ */
+ if (a->mode == b->mode || a->mode == o->mode)
+ result.mode = b->mode;
+ else {
+ result.mode = a->mode;
+ if (b->mode != o->mode) {
+ result.clean = 0;
+ result.merge = 1;
+ }
+ }
- if (sha_eq(a->sha1, o->sha1))
+ if (sha_eq(a->sha1, b->sha1) || sha_eq(a->sha1, o->sha1))
hashcpy(result.sha, b->sha1);
else if (sha_eq(b->sha1, o->sha1))
hashcpy(result.sha, a->sha1);