diff options
author | Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> | 2022-08-09 15:09:08 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-10 23:57:49 +0300 |
commit | b6f51e3db978ae2a72c290a10bd205f9e1d6818e (patch) | |
tree | e80faffa456988fb7fbbe44bb437837b01544acc /t/t7002-mv-sparse-checkout.sh | |
parent | 5784db1b22feceafc72454dccd9637d19fdd422c (diff) |
mv: cleanup empty WORKING_DIRECTORY
Originally, moving from-in-to-out may leave an empty <source>
directory on-disk (this kind of directory is marked as
WORKING_DIRECTORY).
Cleanup such directories if they are empty (don't have any entries
under them).
Modify two tests that take <source> as WORKING_DIRECTORY to test
this behavior.
Suggested-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7002-mv-sparse-checkout.sh')
-rwxr-xr-x | t/t7002-mv-sparse-checkout.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/t/t7002-mv-sparse-checkout.sh b/t/t7002-mv-sparse-checkout.sh index d875f492dd..df8c0fa572 100755 --- a/t/t7002-mv-sparse-checkout.sh +++ b/t/t7002-mv-sparse-checkout.sh @@ -442,6 +442,7 @@ test_expect_success 'move dirty path from in-cone to out-of-cone' ' test_expect_success 'move dir from in-cone to out-of-cone' ' test_when_finished "cleanup_sparse_checkout" && setup_sparse_checkout && + mkdir sub/dir/deep && test_must_fail git mv sub/dir folder1 2>stderr && cat sparse_error_header >expect && @@ -452,6 +453,7 @@ test_expect_success 'move dir from in-cone to out-of-cone' ' git mv --sparse sub/dir folder1 2>stderr && test_must_be_empty stderr && + test_path_is_missing sub/dir && test_path_is_missing folder1 && git ls-files -t >actual && ! grep "H sub/dir/e" actual && @@ -461,6 +463,7 @@ test_expect_success 'move dir from in-cone to out-of-cone' ' test_expect_success 'move partially-dirty dir from in-cone to out-of-cone' ' test_when_finished "cleanup_sparse_checkout" && setup_sparse_checkout && + mkdir sub/dir/deep && touch sub/dir/e2 sub/dir/e3 && git add sub/dir/e2 sub/dir/e3 && echo "modified" >>sub/dir/e2 && @@ -476,6 +479,7 @@ test_expect_success 'move partially-dirty dir from in-cone to out-of-cone' ' git mv --sparse sub/dir folder1 2>stderr && + test_path_is_missing sub/dir && test_path_is_missing folder1/dir/e && test_path_is_file folder1/dir/e2 && test_path_is_file folder1/dir/e3 && |