summaryrefslogtreecommitdiff
path: root/builtin-merge-recursive.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-14 00:16:42 -0700
committerJunio C Hamano <gitster@pobox.com>2008-03-14 00:16:42 -0700
commit16007f3916b885d29de6c48832aa6a4213ab7588 (patch)
treea32a16393cb312398d8c96e61daef15cb708b7f2 /builtin-merge-recursive.c
parentca885a4fe6444bed840295378848904106c87c85 (diff)
parent1b56bc9a1545902db64b8bdce48a499900acfe0b (diff)
downloadgit-16007f3916b885d29de6c48832aa6a4213ab7588.tar.gz
Merge branch 'maint'
* maint: merge-file: handle empty files gracefully merge-recursive: handle file mode changes Minor wording changes in the keyboard descriptions in git-add --interactive. git fetch: Take '-n' to mean '--no-tags' quiltimport: fix misquoting of parsed -p<num> parameter git-quiltimport: better parser to grok "enhanced" series files.
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);