]>
git.ipfire.org Git - thirdparty/git.git/blob - t/t7502-status.sh
3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description
='git-status'
10 test_expect_success
'setup' '
24 git commit -m initial &&
28 echo 1 > dir1/modified &&
29 echo 2 > dir2/modified &&
30 echo 3 > dir2/added &&
34 test_expect_success
'status (1)' '
36 grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
42 # Changes to be committed:
43 # (use "git reset HEAD <file>..." to unstage)
45 # new file: dir2/added
47 # Changed but not updated:
48 # (use "git add <file>..." to update what will be committed)
50 # modified: dir1/modified
53 # (use "git add <file>..." to include in what will be committed)
63 test_expect_success
'status (2)' '
65 git status > output &&
66 test_cmp expect output
72 # Changes to be committed:
73 # (use "git reset HEAD <file>..." to unstage)
75 # new file: dir2/added
77 # Changed but not updated:
78 # (use "git add <file>..." to update what will be committed)
80 # modified: dir1/modified
83 # (use "git add <file>..." to include in what will be committed)
93 test_expect_success
'status -unormal' '
95 : > dir3/untracked1 &&
96 : > dir3/untracked2 &&
97 git status -unormal >output &&
98 test_cmp expect output
103 # Changes to be committed:
104 # (use "git reset HEAD <file>..." to unstage)
106 # new file: dir2/added
108 # Changed but not updated:
109 # (use "git add <file>..." to update what will be committed)
111 # modified: dir1/modified
114 # (use "git add <file>..." to include in what will be committed)
125 test_expect_success
'status -uall' '
126 git status -uall >output &&
128 test_cmp expect output
133 # Changes to be committed:
134 # (use "git reset HEAD <file>..." to unstage)
136 # new file: ../dir2/added
138 # Changed but not updated:
139 # (use "git add <file>..." to update what will be committed)
144 # (use "git add <file>..." to include in what will be committed)
154 test_expect_success
'status with relative paths' '
156 (cd dir1 && git status) > output &&
157 test_cmp expect output
163 # Changes to be committed:
164 # (use "git reset HEAD <file>..." to unstage)
166 # new file: dir2/added
168 # Changed but not updated:
169 # (use "git add <file>..." to update what will be committed)
171 # modified: dir1/modified
174 # (use "git add <file>..." to include in what will be committed)
184 test_expect_success
'status without relative paths' '
186 git config status.relativePaths false
187 (cd dir1 && git status) > output &&
188 test_cmp expect output
194 # Changes to be committed:
195 # (use "git reset HEAD <file>..." to unstage)
197 # modified: dir1/modified
200 # (use "git add <file>..." to include in what will be committed)
208 test_expect_success
'status of partial commit excluding new file in index' '
209 git status dir1/modified >output &&
210 test_cmp expect output
213 test_expect_success
'setup status submodule summary' '
214 test_create_repo sm && (
218 git commit -m "Add foo"
225 # Changes to be committed:
226 # (use "git reset HEAD <file>..." to unstage)
228 # new file: dir2/added
231 # Changed but not updated:
232 # (use "git add <file>..." to update what will be committed)
234 # modified: dir1/modified
237 # (use "git add <file>..." to include in what will be committed)
246 test_expect_success
'status submodule summary is disabled by default' '
247 git status >output &&
248 test_cmp expect output
251 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
255 # Changes to be committed:
256 # (use "git reset HEAD <file>..." to unstage)
258 # new file: dir2/added
261 # Changed but not updated:
262 # (use "git add <file>..." to update what will be committed)
264 # modified: dir1/modified
266 # Modified submodules:
268 # * sm 0000000...$head (1):
272 # (use "git add <file>..." to include in what will be committed)
281 test_expect_success
'status submodule summary' '
282 git config status.submodulesummary 10 &&
283 git status >output &&
284 test_cmp expect output
290 # Changed but not updated:
291 # (use "git add <file>..." to update what will be committed)
293 # modified: dir1/modified
296 # (use "git add <file>..." to include in what will be committed)
304 no changes added to commit (use "git add" and/or "git commit -a")
306 test_expect_success
'status submodule summary (clean submodule)' '
307 git commit -m "commit submodule" &&
308 git config status.submodulesummary 10 &&
309 test_must_fail git status >output &&
310 test_cmp expect output
315 # Changes to be committed:
316 # (use "git reset HEAD^1 <file>..." to unstage)
318 # new file: dir2/added
321 # Changed but not updated:
322 # (use "git add <file>..." to update what will be committed)
324 # modified: dir1/modified
326 # Modified submodules:
328 # * sm 0000000...$head (1):
332 # (use "git add <file>..." to include in what will be committed)
341 test_expect_success
'status submodule summary (--amend)' '
342 git config status.submodulesummary 10 &&
343 git status --amend >output &&
344 test_cmp expect output