Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaoxuan Yuan <shaoxuan.yuan02@gmail.com>2022-08-09 15:09:08 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-10 23:57:49 +0300
commitb6f51e3db978ae2a72c290a10bd205f9e1d6818e (patch)
treee80faffa456988fb7fbbe44bb437837b01544acc /t/t7002-mv-sparse-checkout.sh
parent5784db1b22feceafc72454dccd9637d19fdd422c (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-xt/t7002-mv-sparse-checkout.sh4
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 &&