summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-04-19 17:58:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-08 07:11:00 (GMT)
commit6e7e027fe5f4a8d61597a86e7f2b6087e23a759c (patch)
tree6b588b3c6e42ded8aad682c31b51dc437da34af9 /merge-recursive.c
parentbc71c4eebe7ecbb00e06c6b62bc9f0e42aee9d9b (diff)
downloadgit-6e7e027fe5f4a8d61597a86e7f2b6087e23a759c.zip
git-6e7e027fe5f4a8d61597a86e7f2b6087e23a759c.tar.gz
git-6e7e027fe5f4a8d61597a86e7f2b6087e23a759c.tar.bz2
merge-recursive: avoid spurious rename/rename conflict from dir renames
If a file on one side of history was renamed, and merely modified on the other side, then applying a directory rename to the modified side gives us a rename/rename(1to2) conflict. We should only apply directory renames to pairs representing either adds or renames. Making this change means that a directory rename testcase that was previously reported as a rename/delete conflict will now be reported as a modify/delete conflict. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 08c2dc0..d079d67 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1992,7 +1992,7 @@ static void compute_collisions(struct hashmap *collisions,
char *new_path;
struct diff_filepair *pair = pairs->queue[i];
- if (pair->status == 'D')
+ if (pair->status != 'A' && pair->status != 'R')
continue;
dir_rename_ent = check_dir_renamed(pair->two->path,
dir_renames);
@@ -2219,7 +2219,7 @@ static struct string_list *get_renames(struct merge_options *o,
struct diff_filepair *pair = pairs->queue[i];
char *new_path; /* non-NULL only with directory renames */
- if (pair->status == 'D') {
+ if (pair->status != 'A' && pair->status != 'R') {
diff_free_filepair(pair);
continue;
}