git status --ignored: tests and docs

Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jun 2, 2011 at 09:07 UTC 150b493ad42757b60eacbf98ff11982456481982
2 files changed +127
Documentation/git-status.txt
+6
@@ -49,6 +49,9 @@ See linkgit:git-config[1] for configuration variable
49 used to change the default for when the option is not
50 specified.
51
52 +--ignored::
53 + Show ignored files as well.
54 +
55 -z::
56 Terminate entries with NUL, instead of LF. This implies
57 the `--porcelain` output format if no other format is given.
@@ -80,6 +83,8 @@ shows the status of stage #3 (i.e. theirs).
83 For entries that do not have conflicts, `X` shows the status of the index,
84 and `Y` shows the status of the work tree. For untracked paths, `XY` are
85 `??`.
86 +For ignored paths, `XY` are `!!`; they are shown only when the `--ignored`
87 +option is in effect.
88
89 X Y Meaning
90 -------------------------------------------------
@@ -102,6 +107,7 @@ and `Y` shows the status of the work tree. For untracked paths, `XY` are
107 U U unmerged, both modified
108 -------------------------------------------------
109 ? ? untracked
110 + ! ! ignored
111 -------------------------------------------------
112
113
t/t7508-status.sh
+121
@@ -86,6 +86,127 @@ test_expect_success 'status -s (2)' '
86
87 '
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 +
210 cat >expect <<EOF
211 # On branch master
212 # Changes to be committed: