Windows: set gitexecdir = $(bindir)
[git/mingw/4msysgit/wingit-dll.git] / t / t3010-ls-files-killed-modified.sh
blobdc31a8137716da9b4a8c55067a03ce4ac7e773f6
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 test "$no_symlinks" && {
41 function ln () {
42 test "$1" = -s && shift
43 date > "$2"
47 date >path0
48 ln -s xyzzy path1
49 mkdir path2 path3
50 date >path2/file2
51 date >path3/file3
52 : >path7
53 date >path8
54 : >path9
55 date >path10
56 test_expect_success \
57 'git update-index --add to add various paths.' \
58 "git update-index --add -- path0 path1 path?/file? path7 path8 path9 path10"
60 rm -fr path? ;# leave path10 alone
61 date >path2
62 ln -s frotz path3
63 ln -s nitfol path5
64 mkdir path0 path1 path6
65 date >path0/file0
66 date >path1/file1
67 date >path6/file6
68 date >path7
69 : >path8
70 : >path9
71 touch path10
73 test_expect_success \
74 'git ls-files -k to show killed files.' \
75 'git ls-files -k >.output'
76 cat >.expected <<EOF
77 path0/file0
78 path1/file1
79 path2
80 path3
81 EOF
83 test_expect_success \
84 'validate git ls-files -k output.' \
85 'diff .output .expected'
87 test_expect_success \
88 'git ls-files -m to show modified files.' \
89 'git ls-files -m >.output'
90 cat >.expected <<EOF
91 path0
92 path1
93 path2/file2
94 path3/file3
95 path7
96 path8
97 EOF
99 test_expect_success \
100 'validate git ls-files -m output.' \
101 'diff .output .expected'
103 test_done