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>
This commit is contained in:

committed by
Junio C Hamano

parent
bb12ac5120
commit
1affea4f62
@ -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);
|
||||
|
Reference in New Issue
Block a user