diff options
author | Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> | 2022-06-30 04:37:35 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-07-01 23:50:16 +0200 |
commit | 8a26a3915fbe1aab9786b28c535c8541f8df2a19 (patch) | |
tree | fc82c77a720b5cef9bbd6bcb28ffea472e1da9d0 /t/t7002-mv-sparse-checkout.sh | |
parent | mv: check if out-of-cone file exists in index with SKIP_WORKTREE bit (diff) | |
download | git-8a26a3915fbe1aab9786b28c535c8541f8df2a19.tar.xz git-8a26a3915fbe1aab9786b28c535c8541f8df2a19.zip |
mv: check if <destination> exists in index to handle overwriting
Originally, moving a sparse file into cone can result in unwarned
overwrite of existing entry. The expected behavior is that if the
<destination> exists in the entry, user should be prompted to supply
a [-f|--force] to carry out the operation, or the operation should
fail.
Add a check mechanism to do that.
Signed-off-by: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com>
Acked-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-x | t/t7002-mv-sparse-checkout.sh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t7002-mv-sparse-checkout.sh b/t/t7002-mv-sparse-checkout.sh index 1510b5ed6a..6d2fb4f8d2 100755 --- a/t/t7002-mv-sparse-checkout.sh +++ b/t/t7002-mv-sparse-checkout.sh @@ -262,7 +262,7 @@ test_expect_success 'can move out-of-cone file with --sparse' ' test_path_is_file sub/file1 ' -test_expect_failure 'refuse to move sparse file to existing destination' ' +test_expect_success 'refuse to move sparse file to existing destination' ' test_when_finished "cleanup_sparse_checkout" && mkdir folder1 && touch folder1/file1 && @@ -275,7 +275,7 @@ test_expect_failure 'refuse to move sparse file to existing destination' ' test_cmp expect stderr ' -test_expect_failure 'move sparse file to existing destination with --force and --sparse' ' +test_expect_success 'move sparse file to existing destination with --force and --sparse' ' test_when_finished "cleanup_sparse_checkout" && mkdir folder1 && touch folder1/file1 && |