diff options
author | Clemens Buchacher <drizzd@aon.at> | 2008-03-13 23:47:41 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-13 23:41:16 -0700 |
commit | 1affea4f629537fd48e3bd66de89a6f45d0fcd82 (patch) | |
tree | fa0a6eab955f3c558906b2c90339dc0794536ce4 /merge-recursive.c | |
parent | bb12ac5120b657691b71108cef3e586ba0b76af6 (diff) | |
download | git-1affea4f629537fd48e3bd66de89a6f45d0fcd82.tar.gz |
merge-recursive: handle file mode changes
File mode changes should be handled similarly to changes of content.
That is, if the file mode changed in only one branch, keep the changed
version, and if both branch changed to different mode, mark it as a
conflict.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 34e3167caf..d97cbf7d16 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1028,9 +1028,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); |