dir.c::test_one_path(): work around directory_exists_in_index_icase() breakage
[git/gitweb.git] / t / t3010-ls-files-killed-modified.sh
blobab1deae3b2e759b1cdbc22fd4c5c4bcf31f306c1
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git ls-files -k and -m flags test.
8 This test prepares the following in the cache:
10 path0 - a file
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
16 and the following on the filesystem:
18 path0/file0 - a file in a directory
19 path1/file1 - a file in a directory
20 path2 - a file
21 path3 - a symlink
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
27 git ls-files -k should report that existing filesystem
28 objects except path4, path5 and path6/file6 to be killed.
30 Also for modification test, the cache and working tree have:
32 path7 - an empty file, modified to a non-empty file.
33 path8 - a non-empty file, modified to an empty file.
34 path9 - an empty file, cache dirtied.
35 path10 - a non-empty file, cache dirtied.
37 We should report path0, path1, path2/file2, path3/file3, path7 and path8
38 modified without reporting path9 and path10.
40 . ./test-lib.sh
42 date >path0
43 if test_have_prereq SYMLINKS
44 then
45 ln -s xyzzy path1
46 else
47 date > path1
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.' \
59 "git update-index --add -- path0 path1 path?/file? pathx/ju path7 path8 path9 path10"
61 rm -fr path? ;# leave path10 alone
62 date >path2
63 if test_have_prereq SYMLINKS
64 then
65 ln -s frotz path3
66 ln -s nitfol path5
67 else
68 date > path3
69 date > path5
71 mkdir -p path0 path1 path6 pathx/ju
72 date >path0/file0
73 date >path1/file1
74 date >path6/file6
75 date >path7
76 : >path8
77 : >path9
78 touch path10
79 >pathx/ju/nk
81 cat >.expected <<EOF
82 path0/file0
83 path1/file1
84 path2
85 path3
86 pathx/ju/nk
87 EOF
89 test_expect_success 'git ls-files -k to show killed files (w/o icase)' '
90 git ls-files -k >.output &&
91 test_cmp .expected .output
94 test_expect_success 'git ls-files -k to show killed files (w/ icase)' '
95 git -c core.ignorecase=true ls-files -k >.output &&
96 test_cmp .expected .output
99 test_expect_success \
100 'git ls-files -m to show modified files.' \
101 'git ls-files -m >.output'
102 cat >.expected <<EOF
103 path0
104 path1
105 path2/file2
106 path3/file3
107 path7
108 path8
109 pathx/ju
112 test_expect_success \
113 'validate git ls-files -m output.' \
114 'test_cmp .expected .output'
116 test_done