Skip to content

Commit 98a1a00

Browse files
gtkillergitster
authored andcommitted
t6423: add a testcase causing a failed assertion in process_renames
If one side of history renames a directory A/ -> B/, and the other side of history adds new files to A/, then directory rename detection notices and moves or suggests moving those new files to B/. A similar thing is done for paths renamed into A/, causing them to be transitively renamed into B/. But, if the file originally came from B/, then this can end up causing a file to be renamed back to itself. merge-ort crashes under this special case, due to a slightly overzealous assertion: git: merge-ort.c:3051: process_renames: Assertion `source_deleted || oldinfo->filemask & old_sidemask' failed. Aborted (core dumped) Add a testcase demonstrating this. Signed-off-by: Dmitry Goncharov <[email protected]> [en: Instead of adding a new testsuite, place it near similar tests in t6423, adjusting to match the style of those tests. Tweak the commit message to not repeat the entire testcase, but just describe the bug. Also update the line number in the error message.] Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e969bc8 commit 98a1a00

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

t/t6423-merge-rename-directories.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5363,6 +5363,47 @@ test_expect_merge_algorithm failure success '12m: Change parent of renamed-dir t
53635363
)
53645364
'
53655365

5366+
test_setup_12n () {
5367+
git init 12n &&
5368+
(
5369+
cd 12n &&
5370+
5371+
mkdir tools &&
5372+
echo hello >tools/hello &&
5373+
git add tools/hello &&
5374+
git commit -m "O" &&
5375+
5376+
git branch O &&
5377+
git branch A &&
5378+
git branch B &&
5379+
5380+
git switch A &&
5381+
echo world >world &&
5382+
git add world &&
5383+
git commit -q world -m 'Add world' &&
5384+
5385+
git mv world tools/world &&
5386+
git commit -m "Move world into tools/" &&
5387+
5388+
git switch B &&
5389+
git mv tools/hello hello &&
5390+
git commit -m "Move hello from tools/ to toplevel"
5391+
)
5392+
}
5393+
5394+
test_expect_failure '12n: Directory rename transitively makes rename back to self' '
5395+
test_setup_12n &&
5396+
(
5397+
cd 12n &&
5398+
5399+
git checkout -q B^0 &&
5400+
5401+
test_must_fail git cherry-pick A^0 >out &&
5402+
grep "CONFLICT (file location).*should perhaps be moved" out
5403+
)
5404+
'
5405+
5406+
53665407
###########################################################################
53675408
# SECTION 13: Checking informational and conflict messages
53685409
#

0 commit comments

Comments
 (0)