[PATCH 2/2] The core GIT tests: recent additions and fixes.
[git/gitweb.git] / t / t0500-ls-files.sh
blobc4d6d2163f6f84da6911fa18136e78d7a0dd1b27
1 #!/bin/sh
3 # Copyright (c) 2005 Junio C Hamano
6 test_description='git-ls-files -k flag 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 . ./test-lib.sh
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?"
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
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
58 test_expect_success \
59 'validate git-ls-files -k output.' \
60 'diff .output .expected'
61 test_done