summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-09-24 15:39:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-28 17:31:02 (GMT)
commitf9786f9b85a6930a711e0ca8ba317c619f02bd8b (patch)
treef9ba93140dab018ca906e371ae93a0b110644229 /t
parent61d450f049eeb61e6cb3c07750e806db29ff0ea3 (diff)
downloadgit-f9786f9b85a6930a711e0ca8ba317c619f02bd8b.zip
git-f9786f9b85a6930a711e0ca8ba317c619f02bd8b.tar.gz
git-f9786f9b85a6930a711e0ca8ba317c619f02bd8b.tar.bz2
rm: add --sparse option
As we did previously in 'git add', add a '--sparse' option to 'git rm' that allows modifying paths outside of the sparse-checkout definition. The existing checks in 'git rm' are restricted to tracked files that have the SKIP_WORKTREE bit in the current index. Future changes will cause 'git rm' to reject removing paths outside of the sparse-checkout definition, even if they are untracked or do not have the SKIP_WORKTREE bit. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t3602-rm-sparse-checkout.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t3602-rm-sparse-checkout.sh b/t/t3602-rm-sparse-checkout.sh
index e9e9a15..493c8f6 100755
--- a/t/t3602-rm-sparse-checkout.sh
+++ b/t/t3602-rm-sparse-checkout.sh
@@ -43,6 +43,18 @@ test_expect_success 'recursive rm does not remove sparse entries' '
test_cmp expected actual
'
+test_expect_success 'recursive rm --sparse removes sparse entries' '
+ git reset --hard &&
+ git sparse-checkout set "sub/dir" &&
+ git rm --sparse -r sub &&
+ git status --porcelain -uno >actual &&
+ cat >expected <<-\EOF &&
+ D sub/d
+ D sub/dir/e
+ EOF
+ test_cmp expected actual
+'
+
test_expect_success 'rm obeys advice.updateSparsePath' '
git reset --hard &&
git sparse-checkout set a &&