GIT v1.5.0-rc2
[git/mingw/4msysgit/wingit-dll.git] / t / t3010-ls-files-killed-modified.sh
blob5fc19767117fae3e0f41dd6061a69ff177ede1a4
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
15 and the following on the filesystem:
17 path0/file0 - a file in a directory
18 path1/file1 - a file in a directory
19 path2 - a file
20 path3 - a symlink
21 path4 - a file
22 path5 - a symlink
23 path6/file6 - a file in a directory
25 git-ls-files -k should report that existing filesystem
26 objects except path4, path5 and path6/file6 to be killed.
28 Also for modification test, the cache and working tree have:
30 path7 - an empty file, modified to a non-empty file.
31 path8 - a non-empty file, modified to an empty file.
32 path9 - an empty file, cache dirtied.
33 path10 - a non-empty file, cache dirtied.
35 We should report path0, path1, path2/file2, path3/file3, path7 and path8
36 modified without reporting path9 and path10.
38 . ./test-lib.sh
40 date >path0
41 ln -s xyzzy path1
42 mkdir path2 path3
43 date >path2/file2
44 date >path3/file3
45 : >path7
46 date >path8
47 : >path9
48 date >path10
49 test_expect_success \
50 'git-update-index --add to add various paths.' \
51 "git-update-index --add -- path0 path1 path?/file? path7 path8 path9 path10"
53 rm -fr path? ;# leave path10 alone
54 date >path2
55 ln -s frotz path3
56 ln -s nitfol path5
57 mkdir path0 path1 path6
58 date >path0/file0
59 date >path1/file1
60 date >path6/file6
61 date >path7
62 : >path8
63 : >path9
64 touch path10
66 test_expect_success \
67 'git-ls-files -k to show killed files.' \
68 'git-ls-files -k >.output'
69 cat >.expected <<EOF
70 path0/file0
71 path1/file1
72 path2
73 path3
74 EOF
76 test_expect_success \
77 'validate git-ls-files -k output.' \
78 'diff .output .expected'
80 test_expect_success \
81 'git-ls-files -m to show modified files.' \
82 'git-ls-files -m >.output'
83 cat >.expected <<EOF
84 path0
85 path1
86 path2/file2
87 path3/file3
88 path7
89 path8
90 EOF
92 test_expect_success \
93 'validate git-ls-files -m output.' \
94 'diff .output .expected'
96 test_done