]>
Commit | Line | Data |
---|---|---|
368f99d5 JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Junio C Hamano | |
4 | # | |
5 | ||
b0391890 | 6 | test_description='git-ls-files -k and -m flags test. |
368f99d5 JH |
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. | |
b0391890 JH |
27 | |
28 | Also for modification test, the cache and working tree have: | |
29 | ||
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. | |
34 | ||
35 | We should report path0, path1, path2/file2, path3/file3, path7 and path8 | |
36 | modified without reporting path9 and path10. | |
368f99d5 JH |
37 | ' |
38 | . ./test-lib.sh | |
39 | ||
40 | date >path0 | |
41 | ln -s xyzzy path1 | |
42 | mkdir path2 path3 | |
43 | date >path2/file2 | |
44 | date >path3/file3 | |
b0391890 JH |
45 | : >path7 |
46 | date >path8 | |
47 | : >path9 | |
48 | date >path10 | |
368f99d5 | 49 | test_expect_success \ |
215a7ad1 | 50 | 'git-update-index --add to add various paths.' \ |
b0391890 | 51 | "git-update-index --add -- path0 path1 path?/file? path7 path8 path9 path10" |
368f99d5 | 52 | |
b0391890 | 53 | rm -fr path? ;# leave path10 alone |
368f99d5 JH |
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 | |
b0391890 JH |
61 | date >path7 |
62 | : >path8 | |
63 | : >path9 | |
64 | touch path10 | |
368f99d5 JH |
65 | |
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 | |
75 | ||
76 | test_expect_success \ | |
77 | 'validate git-ls-files -k output.' \ | |
78 | 'diff .output .expected' | |
b0391890 JH |
79 | |
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 | |
91 | ||
92 | test_expect_success \ | |
93 | 'validate git-ls-files -m output.' \ | |
94 | 'diff .output .expected' | |
95 | ||
368f99d5 | 96 | test_done |