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 git diff 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)
87 # (use "git add <file>..." to include in what will be committed)
97 test_expect_success
'status with relative paths' '
99 (cd dir1 && git status) > output &&
100 git diff expect output
106 # Changes to be committed:
107 # (use "git reset HEAD <file>..." to unstage)
109 # new file: dir2/added
111 # Changed but not updated:
112 # (use "git add <file>..." to update what will be committed)
114 # modified: dir1/modified
117 # (use "git add <file>..." to include in what will be committed)
127 test_expect_success
'status without relative paths' '
129 git config status.relativePaths false
130 (cd dir1 && git status) > output &&
131 git diff expect output
137 # Changes to be committed:
138 # (use "git reset HEAD <file>..." to unstage)
140 # modified: dir1/modified
143 # (use "git add <file>..." to include in what will be committed)
151 test_expect_success
'status of partial commit excluding new file in index' '
152 git status dir1/modified >output &&
153 test_cmp expect output
156 test_expect_success
'setup status submodule summary' '
157 test_create_repo sm && (
161 git commit -m "Add foo"
168 # Changes to be committed:
169 # (use "git reset HEAD <file>..." to unstage)
171 # new file: dir2/added
174 # Changed but not updated:
175 # (use "git add <file>..." to update what will be committed)
177 # modified: dir1/modified
180 # (use "git add <file>..." to include in what will be committed)
189 test_expect_success
'status submodule summary is disabled by default' '
190 git status >output &&
191 test_cmp expect output
194 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
198 # Changes to be committed:
199 # (use "git reset HEAD <file>..." to unstage)
201 # new file: dir2/added
204 # Changed but not updated:
205 # (use "git add <file>..." to update what will be committed)
207 # modified: dir1/modified
209 # Modified submodules:
211 # * sm 0000000...$head (1):
215 # (use "git add <file>..." to include in what will be committed)
224 test_expect_success
'status submodule summary' '
225 git config status.submodulesummary 10 &&
226 git status >output &&
227 test_cmp expect output
233 # Changed but not updated:
234 # (use "git add <file>..." to update what will be committed)
236 # modified: dir1/modified
239 # (use "git add <file>..." to include in what will be committed)
247 no changes added to commit (use "git add" and/or "git commit -a")
249 test_expect_success
'status submodule summary (clean submodule)' '
250 git commit -m "commit submodule" &&
251 git config status.submodulesummary 10 &&
252 test_must_fail git status >output &&
253 test_cmp expect output
258 # Changes to be committed:
259 # (use "git reset HEAD^1 <file>..." to unstage)
261 # new file: dir2/added
264 # Changed but not updated:
265 # (use "git add <file>..." to update what will be committed)
267 # modified: dir1/modified
269 # Modified submodules:
271 # * sm 0000000...$head (1):
275 # (use "git add <file>..." to include in what will be committed)
284 test_expect_success
'status submodule summary (--amend)' '
285 git config status.submodulesummary 10 &&
286 git status --amend >output &&
287 test_cmp expect output