diff options
author | Schalk, Ken <ken.schalk@intel.com> | 2010-09-01 13:15:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-09-03 11:26:49 -0700 |
commit | d5af51053cd060d7a4893f030626b04351554d1b (patch) | |
tree | b9d94c906c213c3ddb8f6cade1d96815fcce006c /merge-recursive.c | |
parent | 22da742982eeeb95b6fb4cd757509a8c4c2202d8 (diff) | |
download | git-d5af51053cd060d7a4893f030626b04351554d1b.tar.gz git-d5af51053cd060d7a4893f030626b04351554d1b.tar.xz |
RE: [PATCH] Avoid rename/add conflict when contents are identical
>Due to this this (and maybe all the tests) need to depend on the
>SYMLINKS prereq.
Here's a third attempt with no use of symlinks in the test:
Skip the entire rename/add conflict case if the file added on the
other branch has the same contents as the file being renamed. This
avoids giving the user an extra copy of the same file and presenting a
conflict that is confusing and pointless.
A simple test of this case has been added in
t/t3030-merge-recursive.sh.
Signed-off-by: Ken Schalk <ken.schalk@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index fb6aa4a55..a2fba84d9 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -955,6 +955,12 @@ static int process_renames(struct merge_options *o, ren1->pair->two : NULL, branch1 == o->branch1 ? NULL : ren1->pair->two, 1); + } else if ((dst_other.mode == ren1->pair->two->mode) && + sha_eq(dst_other.sha1, ren1->pair->two->sha1)) { + /* Added file on the other side + identical to the file being + renamed: clean merge */ + update_file(o, 1, ren1->pair->two->sha1, ren1->pair->two->mode, ren1_dst); } else if (!sha_eq(dst_other.sha1, null_sha1)) { const char *new_path; clean_merge = 0; |