mirror of
https://github.com/git/git.git
synced 2026-04-10 00:40:14 +02:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
5784db1b22
commit
b6f51e3db9
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user