Skip to content

Commit

Permalink
t3600: test behavior of reverse-d/f conflict
Browse files Browse the repository at this point in the history
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Apr 4, 2013
1 parent 9a6728d commit 96ec8ee
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions t/t3600-rm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -647,4 +647,16 @@ test_expect_success SYMLINKS 'rm of d/f when d has become a dangling symlink' '
test_path_is_missing d
'

test_expect_success 'rm of file when it has become a directory' '
rm -rf d &&
>d &&
git add d &&
rm -f d &&
mkdir d &&
>d/f &&
test_must_fail git rm d &&
git rev-parse --verify :d &&
test_path_is_file d/f
'

test_done

0 comments on commit 96ec8ee

Please sign in to comment.