merge-recursive: fix merging a subdirectory into the root directory
We allow renaming all entries in e.g. a directory named z/ into a
directory named y/ to be detected as a z/ -> y/ rename, so that if the
other side of history adds any files to the directory z/ in the mean
time, we can provide the hint that they should be moved to y/.
There is no reason to not allow 'y/' to be the root directory, but the
code did not handle that case correctly. Add a testcase and the
necessary special checks to support this case.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Elijah Newren6 years agocommitted byJunio C Hamano
@ -4051,6 +4051,120 @@ test_expect_success '12c-check: Moving one directory hierarchy into another w/ c
@@ -4051,6 +4051,120 @@ test_expect_success '12c-check: Moving one directory hierarchy into another w/ c
)
'
# Testcase 12d, Rename/merge of subdirectory into the root
# Commit O: a/b/subdir/foo
# Commit A: subdir/foo
# Commit B: a/b/subdir/foo, a/b/bar
# Expected: subdir/foo, bar
test_expect_success '12d-setup: Rename/merge subdir into the root, variant 1' '
test_create_repo 12d &&
(
cd 12d &&
mkdir -p a/b/subdir &&
test_commit a/b/subdir/foo &&
git branch O &&
git branch A &&
git branch B &&
git checkout A &&
mkdir subdir &&
git mv a/b/subdir/foo.t subdir/foo.t &&
test_tick &&
git commit -m "A" &&
git checkout B &&
test_commit a/b/bar
)
'
test_expect_success '12d-check: Rename/merge subdir into the root, variant 1' '