t3010: update to demonstrate "ls-files -k" optimization pitfalls

An earlier draft of the previous step used cache_name_exists() to check the directory we were looking at, which missed the second case described in its log message. Demonstrate why it is not sufficient. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 15, 2013 at 13:51 UTC 3c56875176390eee7d81795294124ce90189d876
1 file changed +9 -3
t/t3010-ls-files-killed-modified.sh
+9 -3
@@ -11,6 +11,7 @@ This test prepares the following in the cache:
11 path1 - a symlink
12 path2/file2 - a file in a directory
13 path3/file3 - a file in a directory
14 + pathx/ju - a file in a directory
15
16 and the following on the filesystem:
17
@@ -21,6 +22,7 @@ and the following on the filesystem:
22 path4 - a file
23 path5 - a symlink
24 path6/file6 - a file in a directory
25 + pathx/ju/nk - a file in a directory to be killed
26
27 git ls-files -k should report that existing filesystem
28 objects except path4, path5 and path6/file6 to be killed.
@@ -44,16 +46,17 @@ then
46 else
47 date > path1
48 fi
47 -mkdir path2 path3
49 +mkdir path2 path3 pathx
50 date >path2/file2
51 date >path3/file3
52 +>pathx/ju
53 : >path7
54 date >path8
55 : >path9
56 date >path10
57 test_expect_success \
58 'git update-index --add to add various paths.' \
56 - "git update-index --add -- path0 path1 path?/file? path7 path8 path9 path10"
59 + "git update-index --add -- path0 path1 path?/file? pathx/ju path7 path8 path9 path10"
60
61 rm -fr path? ;# leave path10 alone
62 date >path2
@@ -65,7 +68,7 @@ else
68 date > path3
69 date > path5
70 fi
68 -mkdir path0 path1 path6
71 +mkdir -p path0 path1 path6 pathx/ju
72 date >path0/file0
73 date >path1/file1
74 date >path6/file6
@@ -73,6 +76,7 @@ date >path7
76 : >path8
77 : >path9
78 touch path10
79 +>pathx/ju/nk
80
81 test_expect_success \
82 'git ls-files -k to show killed files.' \
@@ -82,6 +86,7 @@ path0/file0
86 path1/file1
87 path2
88 path3
89 +pathx/ju/nk
90 EOF
91
92 test_expect_success \
@@ -98,6 +103,7 @@ path2/file2
103 path3/file3
104 path7
105 path8
106 +pathx/ju
107 EOF
108
109 test_expect_success \