t1011: fix sparse-checkout initialization and add new file

Do not append to $GIT_DIR/info/sparse-checkout at each test, overwrite it instead. Also add sub/addedtoo for more complex tests later on Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed May 2, 2011 at 19:47 UTC d61ebbe8f57107afe1b04005be420117d3806675
1 file changed +8 -4
t/t1011-read-tree-sparse-checkout.sh
+8 -4
@@ -17,19 +17,21 @@ test_expect_success 'setup' '
17 cat >expected <<-\EOF &&
18 100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0 init.t
19 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 sub/added
20 + 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 sub/addedtoo
21 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 subsub/added
22 EOF
23 cat >expected.swt <<-\EOF &&
24 H init.t
25 H sub/added
26 + H sub/addedtoo
27 H subsub/added
28 EOF
29
30 test_commit init &&
31 echo modified >>init.t &&
32 mkdir sub subsub &&
31 - touch sub/added subsub/added &&
32 - git add init.t sub/added subsub/added &&
33 + touch sub/added sub/addedtoo subsub/added &&
34 + git add init.t sub/added sub/addedtoo subsub/added &&
35 git commit -m "modified and added" &&
36 git tag top &&
37 git rm sub/added &&
@@ -83,6 +85,7 @@ test_expect_success 'match directories with trailing slash' '
85 cat >expected.swt-noinit <<-\EOF &&
86 S init.t
87 H sub/added
88 + H sub/addedtoo
89 S subsub/added
90 EOF
91
@@ -95,7 +98,7 @@ test_expect_success 'match directories with trailing slash' '
98 '
99
100 test_expect_success 'match directories without trailing slash' '
98 - echo sub >>.git/info/sparse-checkout &&
101 + echo sub >.git/info/sparse-checkout &&
102 git read-tree -m -u HEAD &&
103 git ls-files -t >result &&
104 test_cmp expected.swt-noinit result &&
@@ -104,7 +107,7 @@ test_expect_success 'match directories without trailing slash' '
107 '
108
109 test_expect_success 'match directory pattern' '
107 - echo "s?b" >>.git/info/sparse-checkout &&
110 + echo "s?b" >.git/info/sparse-checkout &&
111 git read-tree -m -u HEAD &&
112 git ls-files -t >result &&
113 test_cmp expected.swt-noinit result &&
@@ -116,6 +119,7 @@ test_expect_success 'checkout area changes' '
119 cat >expected.swt-nosub <<-\EOF &&
120 H init.t
121 S sub/added
122 + S sub/addedtoo
123 S subsub/added
124 EOF
125