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:
12 path2/file2 - a file in a directory
13 path3/file3 - a file in a directory
14 submod1/ - a submodule
15 submod2/ - another submodule
17 and the following on the filesystem:
19 path0/file0 - a file in a directory
20 path1/file1 - a file in a directory
25 path6/file6 - a file in a directory
26 submod1/ - a submodule (modified from the cache)
27 submod2/ - a submodule (matches the cache)
29 git ls-files -k should report that existing filesystem objects
30 path0/*, path1/*, path2 and path3 to be killed.
32 Also for modification test, the cache and working tree have:
34 path7 - an empty file, modified to a non-empty file.
35 path8 - a non-empty file, modified to an empty file.
36 path9 - an empty file, cache dirtied.
37 path10 - a non-empty file, cache dirtied.
39 We should report path0, path1, path2/file2, path3/file3, path7 and path8
40 modified without reporting path9 and path10. submod1 is also modified.
44 test_expect_success 'git update-index --add to add various paths.' '
46 test_ln_s_add xyzzy path1 &&
54 git update-index --add -- path0 path?/file? path7 path8 path9 path10 &&
59 cd submod$i && git commit --allow-empty -m "empty $i"
62 git update-index --add submod[12]
65 git commit --allow-empty -m "empty 1 (updated)"
67 rm -fr path? # leave path10 alone
70 test_expect_success 'git ls-files -k to show killed files.' '
72 if test_have_prereq SYMLINKS
80 mkdir path0 path1 path6 &&
88 git ls-files -k >.output
91 test_expect_success 'validate git ls-files -k output.' '
92 cat >.expected <<-\EOF &&
98 test_cmp .expected .output
101 test_expect_success 'git ls-files -m to show modified files.' '
102 git ls-files -m >.output
105 test_expect_success 'validate git ls-files -m output.' '
106 cat >.expected <<-\EOF &&
115 test_cmp .expected .output