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)
83 # (use "git add <file>..." to include in what will be committed)
93 test_expect_success
'status with relative paths' '
95 (cd dir1 && git status) > output &&
96 test_cmp expect output
102 # Changes to be committed:
103 # (use "git reset HEAD <file>..." to unstage)
105 # new file: dir2/added
107 # Changed but not updated:
108 # (use "git add <file>..." to update what will be committed)
110 # modified: dir1/modified
113 # (use "git add <file>..." to include in what will be committed)
123 test_expect_success
'status without relative paths' '
125 git config status.relativePaths false
126 (cd dir1 && git status) > output &&
127 test_cmp expect output
133 # Changes to be committed:
134 # (use "git reset HEAD <file>..." to unstage)
136 # modified: dir1/modified
139 # (use "git add <file>..." to include in what will be committed)
147 test_expect_success
'status of partial commit excluding new file in index' '
148 git status dir1/modified >output &&
149 test_cmp expect output
152 test_expect_success
'setup status submodule summary' '
153 test_create_repo sm && (
157 git commit -m "Add foo"
164 # Changes to be committed:
165 # (use "git reset HEAD <file>..." to unstage)
167 # new file: dir2/added
170 # Changed but not updated:
171 # (use "git add <file>..." to update what will be committed)
173 # modified: dir1/modified
176 # (use "git add <file>..." to include in what will be committed)
185 test_expect_success
'status submodule summary is disabled by default' '
186 git status >output &&
187 test_cmp expect output
190 head=$
(cd sm
&& git rev-parse
--short=7 --verify HEAD
)
194 # Changes to be committed:
195 # (use "git reset HEAD <file>..." to unstage)
197 # new file: dir2/added
200 # Changed but not updated:
201 # (use "git add <file>..." to update what will be committed)
203 # modified: dir1/modified
205 # Modified submodules:
207 # * sm 0000000...$head (1):
211 # (use "git add <file>..." to include in what will be committed)
220 test_expect_success
'status submodule summary' '
221 git config status.submodulesummary 10 &&
222 git status >output &&
223 test_cmp expect output
229 # Changed but not updated:
230 # (use "git add <file>..." to update what will be committed)
232 # modified: dir1/modified
235 # (use "git add <file>..." to include in what will be committed)
243 no changes added to commit (use "git add" and/or "git commit -a")
245 test_expect_success
'status submodule summary (clean submodule)' '
246 git commit -m "commit submodule" &&
247 git config status.submodulesummary 10 &&
248 test_must_fail git status >output &&
249 test_cmp expect output
254 # Changes to be committed:
255 # (use "git reset HEAD^1 <file>..." to unstage)
257 # new file: dir2/added
260 # Changed but not updated:
261 # (use "git add <file>..." to update what will be committed)
263 # modified: dir1/modified
265 # Modified submodules:
267 # * sm 0000000...$head (1):
271 # (use "git add <file>..." to include in what will be committed)
280 test_expect_success
'status submodule summary (--amend)' '
281 git config status.submodulesummary 10 &&
282 git status --amend >output &&
283 test_cmp expect output