c4d6d2163f6f84da6911fa18136e78d7a0dd1b27
[git.git] / t / t3010-ls-files-killed.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2005 Junio C Hamano
4 #
5
6 test_description='git-ls-files -k flag test.
7
8 This test prepares the following in the cache:
9
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
15 and the following on the filesystem:
16
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
24
25 git-ls-files -k should report that existing filesystem
26 objects except path4, path5 and path6/file6 to be killed.
27 '
28 . ./test-lib.sh
29
30 date >path0
31 ln -s xyzzy path1
32 mkdir path2 path3
33 date >path2/file2
34 date >path3/file3
35 test_expect_success \
36     'git-update-cache --add to add various paths.' \
37     "git-update-cache --add -- path0 path1 path?/file?"
38
39 rm -fr path?
40 date >path2
41 ln -s frotz path3
42 ln -s nitfol path5
43 mkdir path0 path1 path6
44 date >path0/file0
45 date >path1/file1
46 date >path6/file6
47
48 test_expect_success \
49     'git-ls-files -k to show killed files.' \
50     'git-ls-files -k >.output'
51 cat >.expected <<EOF
52 path0/file0
53 path1/file1
54 path2
55 path3
56 EOF
57
58 test_expect_success \
59     'validate git-ls-files -k output.' \
60     'diff .output .expected'
61 test_done