summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-08-20 20:47:13 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2009-08-23 17:14:42 -0700
commit9e1afb16753d583a696c988d33f45655f81e8f7c (patch)
tree0ad696855e2031ebd059dc585810ad24605ee859 /t
parentAdd tests for sparse checkout (diff)
downloadtgif-9e1afb16753d583a696c988d33f45655f81e8f7c.tar.xz
sparse checkout: inhibit empty worktree
The way sparse checkout works, users may empty their worktree completely, because of non-matching sparse-checkout spec, or empty spec. I believe this is not desired. This patch makes Git refuse to produce such worktree. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1009-read-tree-sparse-checkout.sh10
1 files changed, 3 insertions, 7 deletions
diff --git a/t/t1009-read-tree-sparse-checkout.sh b/t/t1009-read-tree-sparse-checkout.sh
index 2192f5abc7..62246dbf95 100755
--- a/t/t1009-read-tree-sparse-checkout.sh
+++ b/t/t1009-read-tree-sparse-checkout.sh
@@ -55,20 +55,16 @@ test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-
test -f sub/added
'
-cat >expected.swt <<EOF
-S init.t
-S sub/added
-EOF
test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
git config core.sparsecheckout true &&
echo > .git/info/sparse-checkout &&
- git read-tree -m -u HEAD &&
+ test_must_fail git read-tree -m -u HEAD &&
git ls-files --stage > result &&
test_cmp expected result &&
git ls-files -t > result &&
test_cmp expected.swt result &&
- test ! -f init.t &&
- test ! -f sub/added
+ test -f init.t &&
+ test -f sub/added
'
cat >expected.swt <<EOF