3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description
='git status'
9 *MINGW
*) GIT_TEST_CMP
="diff -uw";;
14 test_expect_success
'setup' '
28 git commit -m initial &&
32 echo 1 > dir1/modified &&
33 echo 2 > dir2/modified &&
34 echo 3 > dir2/added &&
38 test_expect_success
'status (1)' '
40 grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
46 # Changes to be committed:
47 # (use "git reset HEAD <file>..." to unstage)
49 # new file: dir2/added
51 # Changed but not updated:
52 # (use "git add <file>..." to update what will be committed)
54 # modified: dir1/modified
57 # (use "git add <file>..." to include in what will be committed)
67 test_expect_success
'status (2)' '
69 git status > output &&
70 test_cmp expect output
76 # Changes to be committed:
77 # (use "git reset HEAD <file>..." to unstage)
79 # new file: dir2/added
81 # Changed but not updated:
82 # (use "git add <file>..." to update what will be committed)
84 # modified: dir1/modified
86 # Untracked files not listed (use -u option to show untracked files)
88 test_expect_success
'status -uno' '
90 : > dir3/untracked1 &&
91 : > dir3/untracked2 &&
92 git status -uno >output &&
93 test_cmp expect output
96 test_expect_success
'status (status.showUntrackedFiles no)' '
97 git config status.showuntrackedfiles no
99 test_cmp expect output
104 # Changes to be committed:
105 # (use "git reset HEAD <file>..." to unstage)
107 # new file: dir2/added
109 # Changed but not updated:
110 # (use "git add <file>..." to update what will be committed)
112 # modified: dir1/modified
115 # (use "git add <file>..." to include in what will be committed)
125 test_expect_success
'status -unormal' '
126 git status -unormal >output &&
127 test_cmp expect output
130 test_expect_success
'status (status.showUntrackedFiles normal)' '
131 git config status.showuntrackedfiles normal
132 git status >output &&
133 test_cmp expect output
138 # Changes to be committed:
139 # (use "git reset HEAD <file>..." to unstage)
141 # new file: dir2/added
143 # Changed but not updated:
144 # (use "git add <file>..." to update what will be committed)
146 # modified: dir1/modified
149 # (use "git add <file>..." to include in what will be committed)
160 test_expect_success
'status -uall' '
161 git status -uall >output &&
162 test_cmp expect output
164 test_expect_success
'status (status.showUntrackedFiles all)' '
165 git config status.showuntrackedfiles all
166 git status >output &&
168 git config --unset status.showuntrackedfiles &&
169 test_cmp expect output
174 # Changes to be committed:
175 # (use "git reset HEAD <file>..." to unstage)
177 # new file: ../dir2/added
179 # Changed but not updated:
180 # (use "git add <file>..." to update what will be committed)
185 # (use "git add <file>..." to include in what will be committed)
195 test_expect_success
'status with relative paths' '
197 (cd dir1 && git status) > output &&
198 test_cmp expect output
204 # Changes to be committed:
205 # (use "git reset HEAD <file>..." to unstage)
207 # new file: dir2/added
209 # Changed but not updated:
210 # (use "git add <file>..." to update what will be committed)
212 # modified: dir1/modified
215 # (use "git add <file>..." to include in what will be committed)
225 test_expect_success
'status without relative paths' '
227 git config status.relativePaths false
228 (cd dir1 && git status) > output &&
229 test_cmp expect output
235 # Changes to be committed:
236 # (use "git reset HEAD <file>..." to unstage)
238 # modified: dir1/modified
241 # (use "git add <file>..." to include in what will be committed)
249 test_expect_success
'status of partial commit excluding new file in index' '
250 git status dir1/modified >output &&
251 test_cmp expect output
254 test_expect_success
'setup status submodule summary' '
255 test_create_repo sm && (
259 git commit -m "Add foo"
266 # Changes to be committed:
267 # (use "git reset HEAD <file>..." to unstage)
269 # new file: dir2/added
272 # Changed but not updated:
273 # (use "git add <file>..." to update what will be committed)
275 # modified: dir1/modified
278 # (use "git add <file>..." to include in what will be committed)
287 test_expect_success
'status submodule summary is disabled by default' '
288 git status >output &&
289 test_cmp expect output
292 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
296 # Changes to be committed:
297 # (use "git reset HEAD <file>..." to unstage)
299 # new file: dir2/added
302 # Changed but not updated:
303 # (use "git add <file>..." to update what will be committed)
305 # modified: dir1/modified
307 # Modified submodules:
309 # * sm 0000000...$head (1):
313 # (use "git add <file>..." to include in what will be committed)
322 test_expect_success
'status submodule summary' '
323 git config status.submodulesummary 10 &&
324 git status >output &&
325 test_cmp expect output
331 # Changed but not updated:
332 # (use "git add <file>..." to update what will be committed)
334 # modified: dir1/modified
337 # (use "git add <file>..." to include in what will be committed)
345 no changes added to commit (use "git add" and/or "git commit -a")
347 test_expect_success
'status submodule summary (clean submodule)' '
348 git commit -m "commit submodule" &&
349 git config status.submodulesummary 10 &&
350 test_must_fail git status >output &&
351 test_cmp expect output
356 # Changes to be committed:
357 # (use "git reset HEAD^1 <file>..." to unstage)
359 # new file: dir2/added
362 # Changed but not updated:
363 # (use "git add <file>..." to update what will be committed)
365 # modified: dir1/modified
367 # Modified submodules:
369 # * sm 0000000...$head (1):
373 # (use "git add <file>..." to include in what will be committed)
382 test_expect_success
'status submodule summary (--amend)' '
383 git config status.submodulesummary 10 &&
384 git status --amend >output &&
385 test_cmp expect output