]>
Commit | Line | Data |
---|---|---|
eb8c5b87 AP |
1 | #!/bin/sh |
2 | ||
3 | test_description='git-status ignored files' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | cat >expected <<\EOF | |
8 | ?? .gitignore | |
9 | ?? actual | |
10 | ?? expected | |
11 | ?? untracked/ | |
12 | EOF | |
13 | ||
14 | test_expect_success 'status untracked directory with --ignored' ' | |
15 | echo "ignored" >.gitignore && | |
16 | mkdir untracked && | |
17 | : >untracked/ignored && | |
18 | : >untracked/uncommitted && | |
19 | git status --porcelain --ignored >actual && | |
20 | test_cmp expected actual | |
21 | ' | |
22 | ||
23 | cat >expected <<\EOF | |
24 | ?? .gitignore | |
25 | ?? actual | |
26 | ?? expected | |
27 | ?? untracked/uncommitted | |
28 | !! untracked/ignored | |
29 | EOF | |
30 | ||
31 | test_expect_success 'status untracked directory with --ignored -u' ' | |
32 | git status --porcelain --ignored -u >actual && | |
33 | test_cmp expected actual | |
34 | ' | |
35 | ||
36 | cat >expected <<\EOF | |
37 | ?? .gitignore | |
38 | ?? actual | |
39 | ?? expected | |
40 | !! ignored/ | |
41 | EOF | |
42 | ||
43 | test_expect_success 'status ignored directory with --ignore' ' | |
44 | rm -rf untracked && | |
45 | mkdir ignored && | |
46 | : >ignored/uncommitted && | |
47 | git status --porcelain --ignored >actual && | |
48 | test_cmp expected actual | |
49 | ' | |
50 | ||
51 | cat >expected <<\EOF | |
52 | ?? .gitignore | |
53 | ?? actual | |
54 | ?? expected | |
55 | !! ignored/uncommitted | |
56 | EOF | |
57 | ||
58 | test_expect_success 'status ignored directory with --ignore -u' ' | |
59 | git status --porcelain --ignored -u >actual && | |
60 | test_cmp expected actual | |
61 | ' | |
62 | ||
63 | cat >expected <<\EOF | |
64 | ?? .gitignore | |
65 | ?? actual | |
66 | ?? expected | |
67 | !! untracked-ignored/ | |
68 | EOF | |
69 | ||
70 | test_expect_success 'status untracked directory with ignored files with --ignore' ' | |
71 | rm -rf ignored && | |
72 | mkdir untracked-ignored && | |
73 | mkdir untracked-ignored/test && | |
74 | : >untracked-ignored/ignored && | |
75 | : >untracked-ignored/test/ignored && | |
76 | git status --porcelain --ignored >actual && | |
77 | test_cmp expected actual | |
78 | ' | |
79 | ||
80 | cat >expected <<\EOF | |
81 | ?? .gitignore | |
82 | ?? actual | |
83 | ?? expected | |
84 | !! untracked-ignored/ignored | |
85 | !! untracked-ignored/test/ignored | |
86 | EOF | |
87 | ||
88 | test_expect_success 'status untracked directory with ignored files with --ignore -u' ' | |
89 | git status --porcelain --ignored -u >actual && | |
90 | test_cmp expected actual | |
91 | ' | |
92 | ||
93 | cat >expected <<\EOF | |
94 | ?? .gitignore | |
95 | ?? actual | |
96 | ?? expected | |
97 | EOF | |
98 | ||
99 | test_expect_success 'status ignored tracked directory with --ignore' ' | |
100 | rm -rf untracked-ignored && | |
101 | mkdir tracked && | |
102 | : >tracked/committed && | |
103 | git add tracked/committed && | |
104 | git commit -m. && | |
105 | echo "tracked" >.gitignore && | |
106 | git status --porcelain --ignored >actual && | |
107 | test_cmp expected actual | |
108 | ' | |
109 | ||
110 | cat >expected <<\EOF | |
111 | ?? .gitignore | |
112 | ?? actual | |
113 | ?? expected | |
114 | EOF | |
115 | ||
116 | test_expect_success 'status ignored tracked directory with --ignore -u' ' | |
117 | git status --porcelain --ignored -u >actual && | |
118 | test_cmp expected actual | |
119 | ' | |
120 | ||
121 | cat >expected <<\EOF | |
122 | ?? .gitignore | |
123 | ?? actual | |
124 | ?? expected | |
125 | !! tracked/ | |
126 | EOF | |
127 | ||
128 | test_expect_success 'status ignored tracked directory and uncommitted file with --ignore' ' | |
129 | : >tracked/uncommitted && | |
130 | git status --porcelain --ignored >actual && | |
131 | test_cmp expected actual | |
132 | ' | |
133 | ||
134 | cat >expected <<\EOF | |
135 | ?? .gitignore | |
136 | ?? actual | |
137 | ?? expected | |
138 | !! tracked/uncommitted | |
139 | EOF | |
140 | ||
141 | test_expect_success 'status ignored tracked directory and uncommitted file with --ignore -u' ' | |
142 | git status --porcelain --ignored -u >actual && | |
143 | test_cmp expected actual | |
144 | ' | |
145 | ||
146 | test_done |