aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--merge-ort.c3
-rwxr-xr-xt/t6423-merge-rename-directories.sh41
2 files changed, 43 insertions, 1 deletions
diff --git a/merge-ort.c b/merge-ort.c
index 46e78c3ffa..b0ff2236af 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -3048,7 +3048,8 @@ static int process_renames(struct merge_options *opt,
}
}
- assert(source_deleted || oldinfo->filemask & old_sidemask);
+ assert(source_deleted || oldinfo->filemask & old_sidemask ||
+ !strcmp(pair->one->path, pair->two->path));
/* Need to check for special types of rename conflicts... */
if (collision && !source_deleted) {
diff --git a/t/t6423-merge-rename-directories.sh b/t/t6423-merge-rename-directories.sh
index 94080c65d1..79d889b94c 100755
--- a/t/t6423-merge-rename-directories.sh
+++ b/t/t6423-merge-rename-directories.sh
@@ -5363,6 +5363,47 @@ test_expect_merge_algorithm failure success '12m: Change parent of renamed-dir t
)
'
+test_setup_12n () {
+ git init 12n &&
+ (
+ cd 12n &&
+
+ mkdir tools &&
+ echo hello >tools/hello &&
+ git add tools/hello &&
+ git commit -m "O" &&
+
+ git branch O &&
+ git branch A &&
+ git branch B &&
+
+ git switch A &&
+ echo world >world &&
+ git add world &&
+ git commit -q world -m 'Add world' &&
+
+ git mv world tools/world &&
+ git commit -m "Move world into tools/" &&
+
+ git switch B &&
+ git mv tools/hello hello &&
+ git commit -m "Move hello from tools/ to toplevel"
+ )
+}
+
+test_expect_success '12n: Directory rename transitively makes rename back to self' '
+ test_setup_12n &&
+ (
+ cd 12n &&
+
+ git checkout -q B^0 &&
+
+ test_must_fail git cherry-pick A^0 >out &&
+ grep "CONFLICT (file location).*should perhaps be moved" out
+ )
+'
+
+
###########################################################################
# SECTION 13: Checking informational and conflict messages
#