@@ -86,6 +86,127 @@ test_expect_success 'status -s (2)' '
86
86
87
87
'
88
88
89
+ test_expect_success ' status with gitignore' '
90
+ {
91
+ echo ".gitignore" &&
92
+ echo "expect" &&
93
+ echo "output" &&
94
+ echo "untracked"
95
+ } >.gitignore &&
96
+
97
+ cat >expect <<-\EOF &&
98
+ M dir1/modified
99
+ A dir2/added
100
+ ?? dir2/modified
101
+ EOF
102
+ git status -s >output &&
103
+ test_cmp expect output &&
104
+
105
+ cat >expect <<-\EOF &&
106
+ M dir1/modified
107
+ A dir2/added
108
+ ?? dir2/modified
109
+ !! .gitignore
110
+ !! dir1/untracked
111
+ !! dir2/untracked
112
+ !! expect
113
+ !! output
114
+ !! untracked
115
+ EOF
116
+ git status -s --ignored >output &&
117
+ test_cmp expect output &&
118
+
119
+ cat >expect <<-\EOF &&
120
+ # On branch master
121
+ # Changes to be committed:
122
+ # (use "git reset HEAD <file>..." to unstage)
123
+ #
124
+ # new file: dir2/added
125
+ #
126
+ # Changed but not updated:
127
+ # (use "git add <file>..." to update what will be committed)
128
+ # (use "git checkout -- <file>..." to discard changes in working directory)
129
+ #
130
+ # modified: dir1/modified
131
+ #
132
+ # Untracked files:
133
+ # (use "git add <file>..." to include in what will be committed)
134
+ #
135
+ # dir2/modified
136
+ # Ignored files:
137
+ # (use "git add -f <file>..." to include in what will be committed)
138
+ #
139
+ # .gitignore
140
+ # dir1/untracked
141
+ # dir2/untracked
142
+ # expect
143
+ # output
144
+ # untracked
145
+ EOF
146
+ git status --ignored >output &&
147
+ test_cmp expect output
148
+ '
149
+
150
+ test_expect_success ' status with gitignore (nothing untracked)' '
151
+ {
152
+ echo ".gitignore" &&
153
+ echo "expect" &&
154
+ echo "dir2/modified" &&
155
+ echo "output" &&
156
+ echo "untracked"
157
+ } >.gitignore &&
158
+
159
+ cat >expect <<-\EOF &&
160
+ M dir1/modified
161
+ A dir2/added
162
+ EOF
163
+ git status -s >output &&
164
+ test_cmp expect output &&
165
+
166
+ cat >expect <<-\EOF &&
167
+ M dir1/modified
168
+ A dir2/added
169
+ !! .gitignore
170
+ !! dir1/untracked
171
+ !! dir2/modified
172
+ !! dir2/untracked
173
+ !! expect
174
+ !! output
175
+ !! untracked
176
+ EOF
177
+ git status -s --ignored >output &&
178
+ test_cmp expect output &&
179
+
180
+ cat >expect <<-\EOF &&
181
+ # On branch master
182
+ # Changes to be committed:
183
+ # (use "git reset HEAD <file>..." to unstage)
184
+ #
185
+ # new file: dir2/added
186
+ #
187
+ # Changed but not updated:
188
+ # (use "git add <file>..." to update what will be committed)
189
+ # (use "git checkout -- <file>..." to discard changes in working directory)
190
+ #
191
+ # modified: dir1/modified
192
+ #
193
+ # Ignored files:
194
+ # (use "git add -f <file>..." to include in what will be committed)
195
+ #
196
+ # .gitignore
197
+ # dir1/untracked
198
+ # dir2/modified
199
+ # dir2/untracked
200
+ # expect
201
+ # output
202
+ # untracked
203
+ EOF
204
+ git status --ignored >output &&
205
+ test_cmp expect output
206
+ '
207
+
208
+ rm -f .gitignore
209
+
89
210
cat > expect << EOF
90
211
# On branch master
91
212
# Changes to be committed:
0 commit comments