Skip to content

Commit 96ec8ee

Browse files
peffgitster
authored andcommitted
t3600: test behavior of reverse-d/f conflict
The previous commit taught "rm" that it is safe to consider "d/f" removed when "d" has become a non-directory. This patch adds a test for the opposite: a file "d" that becomes a directory. In this case, "git rm" does need to complain, because we should not be removing arbitrary content under "d". Git already behaves correctly, but let's make sure that remains the case by protecting the behavior with a test. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9a6728d commit 96ec8ee

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

t/t3600-rm.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,4 +647,16 @@ test_expect_success SYMLINKS 'rm of d/f when d has become a dangling symlink' '
647647
test_path_is_missing d
648648
'
649649

650+
test_expect_success 'rm of file when it has become a directory' '
651+
rm -rf d &&
652+
>d &&
653+
git add d &&
654+
rm -f d &&
655+
mkdir d &&
656+
>d/f &&
657+
test_must_fail git rm d &&
658+
git rev-parse --verify :d &&
659+
test_path_is_file d/f
660+
'
661+
650662
test_done

0 commit comments

Comments
 (0)