From 9e1afb16753d583a696c988d33f45655f81e8f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Thu, 20 Aug 2009 20:47:13 +0700 Subject: sparse checkout: inhibit empty worktree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- t/t1009-read-tree-sparse-checkout.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 't') 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 < .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 <