]> git.ipfire.org Git - thirdparty/git.git/blob - t/t7512-status-help.sh
commit: describe that --no-verify skips the commit-msg hook in the help text
[thirdparty/git.git] / t / t7512-status-help.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2012 Valentin Duperray, Lucien Kong, Franck Jonas,
4 # Thomas Nguy, Khoi Nguyen
5 # Grenoble INP Ensimag
6 #
7
8 test_description='git status advice'
9
10 . ./test-lib.sh
11
12 . "$TEST_DIRECTORY"/lib-rebase.sh
13
14 set_fake_editor
15
16 test_expect_success 'prepare for conflicts' '
17 git config --global advice.statusuoption false &&
18 test_commit init main.txt init &&
19 git branch conflicts &&
20 test_commit on_master main.txt on_master &&
21 git checkout conflicts &&
22 test_commit on_conflicts main.txt on_conflicts
23 '
24
25
26 test_expect_success 'status when conflicts unresolved' '
27 test_must_fail git merge master &&
28 cat >expected <<\EOF &&
29 On branch conflicts
30 You have unmerged paths.
31 (fix conflicts and run "git commit")
32
33 Unmerged paths:
34 (use "git add <file>..." to mark resolution)
35
36 both modified: main.txt
37
38 no changes added to commit (use "git add" and/or "git commit -a")
39 EOF
40 git status --untracked-files=no >actual &&
41 test_i18ncmp expected actual
42 '
43
44
45 test_expect_success 'status when conflicts resolved before commit' '
46 git reset --hard conflicts &&
47 test_must_fail git merge master &&
48 echo one >main.txt &&
49 git add main.txt &&
50 cat >expected <<\EOF &&
51 On branch conflicts
52 All conflicts fixed but you are still merging.
53 (use "git commit" to conclude merge)
54
55 Changes to be committed:
56
57 modified: main.txt
58
59 Untracked files not listed (use -u option to show untracked files)
60 EOF
61 git status --untracked-files=no >actual &&
62 test_i18ncmp expected actual
63 '
64
65
66 test_expect_success 'prepare for rebase conflicts' '
67 git reset --hard master &&
68 git checkout -b rebase_conflicts &&
69 test_commit one_rebase main.txt one &&
70 test_commit two_rebase main.txt two &&
71 test_commit three_rebase main.txt three
72 '
73
74
75 test_expect_success 'status when rebase in progress before resolving conflicts' '
76 test_when_finished "git rebase --abort" &&
77 ONTO=$(git rev-parse --short HEAD^^) &&
78 test_must_fail git rebase HEAD^ --onto HEAD^^ &&
79 cat >expected <<EOF &&
80 rebase in progress; onto $ONTO
81 You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''.
82 (fix conflicts and then run "git rebase --continue")
83 (use "git rebase --skip" to skip this patch)
84 (use "git rebase --abort" to check out the original branch)
85
86 Unmerged paths:
87 (use "git reset HEAD <file>..." to unstage)
88 (use "git add <file>..." to mark resolution)
89
90 both modified: main.txt
91
92 no changes added to commit (use "git add" and/or "git commit -a")
93 EOF
94 git status --untracked-files=no >actual &&
95 test_i18ncmp expected actual
96 '
97
98
99 test_expect_success 'status when rebase in progress before rebase --continue' '
100 git reset --hard rebase_conflicts &&
101 test_when_finished "git rebase --abort" &&
102 ONTO=$(git rev-parse --short HEAD^^) &&
103 test_must_fail git rebase HEAD^ --onto HEAD^^ &&
104 echo three >main.txt &&
105 git add main.txt &&
106 cat >expected <<EOF &&
107 rebase in progress; onto $ONTO
108 You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''.
109 (all conflicts fixed: run "git rebase --continue")
110
111 Changes to be committed:
112 (use "git reset HEAD <file>..." to unstage)
113
114 modified: main.txt
115
116 Untracked files not listed (use -u option to show untracked files)
117 EOF
118 git status --untracked-files=no >actual &&
119 test_i18ncmp expected actual
120 '
121
122
123 test_expect_success 'prepare for rebase_i_conflicts' '
124 git reset --hard master &&
125 git checkout -b rebase_i_conflicts &&
126 test_commit one_unmerge main.txt one_unmerge &&
127 git branch rebase_i_conflicts_second &&
128 test_commit one_master main.txt one_master &&
129 git checkout rebase_i_conflicts_second &&
130 test_commit one_second main.txt one_second
131 '
132
133
134 test_expect_success 'status during rebase -i when conflicts unresolved' '
135 test_when_finished "git rebase --abort" &&
136 ONTO=$(git rev-parse --short rebase_i_conflicts) &&
137 test_must_fail git rebase -i rebase_i_conflicts &&
138 cat >expected <<EOF &&
139 rebase in progress; onto $ONTO
140 You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''.
141 (fix conflicts and then run "git rebase --continue")
142 (use "git rebase --skip" to skip this patch)
143 (use "git rebase --abort" to check out the original branch)
144
145 Unmerged paths:
146 (use "git reset HEAD <file>..." to unstage)
147 (use "git add <file>..." to mark resolution)
148
149 both modified: main.txt
150
151 no changes added to commit (use "git add" and/or "git commit -a")
152 EOF
153 git status --untracked-files=no >actual &&
154 test_i18ncmp expected actual
155 '
156
157
158 test_expect_success 'status during rebase -i after resolving conflicts' '
159 git reset --hard rebase_i_conflicts_second &&
160 test_when_finished "git rebase --abort" &&
161 ONTO=$(git rev-parse --short rebase_i_conflicts) &&
162 test_must_fail git rebase -i rebase_i_conflicts &&
163 git add main.txt &&
164 cat >expected <<EOF &&
165 rebase in progress; onto $ONTO
166 You are currently rebasing branch '\''rebase_i_conflicts_second'\'' on '\''$ONTO'\''.
167 (all conflicts fixed: run "git rebase --continue")
168
169 Changes to be committed:
170 (use "git reset HEAD <file>..." to unstage)
171
172 modified: main.txt
173
174 Untracked files not listed (use -u option to show untracked files)
175 EOF
176 git status --untracked-files=no >actual &&
177 test_i18ncmp expected actual
178 '
179
180
181 test_expect_success 'status when rebasing -i in edit mode' '
182 git reset --hard master &&
183 git checkout -b rebase_i_edit &&
184 test_commit one_rebase_i main.txt one &&
185 test_commit two_rebase_i main.txt two &&
186 test_commit three_rebase_i main.txt three &&
187 FAKE_LINES="1 edit 2" &&
188 export FAKE_LINES &&
189 test_when_finished "git rebase --abort" &&
190 ONTO=$(git rev-parse --short HEAD~2) &&
191 git rebase -i HEAD~2 &&
192 cat >expected <<EOF &&
193 rebase in progress; onto $ONTO
194 You are currently editing a commit while rebasing branch '\''rebase_i_edit'\'' on '\''$ONTO'\''.
195 (use "git commit --amend" to amend the current commit)
196 (use "git rebase --continue" once you are satisfied with your changes)
197
198 nothing to commit (use -u to show untracked files)
199 EOF
200 git status --untracked-files=no >actual &&
201 test_i18ncmp expected actual
202 '
203
204
205 test_expect_success 'status when splitting a commit' '
206 git reset --hard master &&
207 git checkout -b split_commit &&
208 test_commit one_split main.txt one &&
209 test_commit two_split main.txt two &&
210 test_commit three_split main.txt three &&
211 test_commit four_split main.txt four &&
212 FAKE_LINES="1 edit 2 3" &&
213 export FAKE_LINES &&
214 test_when_finished "git rebase --abort" &&
215 ONTO=$(git rev-parse --short HEAD~3) &&
216 git rebase -i HEAD~3 &&
217 git reset HEAD^ &&
218 cat >expected <<EOF &&
219 rebase in progress; onto $ONTO
220 You are currently splitting a commit while rebasing branch '\''split_commit'\'' on '\''$ONTO'\''.
221 (Once your working directory is clean, run "git rebase --continue")
222
223 Changes not staged for commit:
224 (use "git add <file>..." to update what will be committed)
225 (use "git checkout -- <file>..." to discard changes in working directory)
226
227 modified: main.txt
228
229 no changes added to commit (use "git add" and/or "git commit -a")
230 EOF
231 git status --untracked-files=no >actual &&
232 test_i18ncmp expected actual
233 '
234
235
236 test_expect_success 'status after editing the last commit with --amend during a rebase -i' '
237 git reset --hard master &&
238 git checkout -b amend_last &&
239 test_commit one_amend main.txt one &&
240 test_commit two_amend main.txt two &&
241 test_commit three_amend main.txt three &&
242 test_commit four_amend main.txt four &&
243 FAKE_LINES="1 2 edit 3" &&
244 export FAKE_LINES &&
245 test_when_finished "git rebase --abort" &&
246 ONTO=$(git rev-parse --short HEAD~3) &&
247 git rebase -i HEAD~3 &&
248 git commit --amend -m "foo" &&
249 cat >expected <<EOF &&
250 rebase in progress; onto $ONTO
251 You are currently editing a commit while rebasing branch '\''amend_last'\'' on '\''$ONTO'\''.
252 (use "git commit --amend" to amend the current commit)
253 (use "git rebase --continue" once you are satisfied with your changes)
254
255 nothing to commit (use -u to show untracked files)
256 EOF
257 git status --untracked-files=no >actual &&
258 test_i18ncmp expected actual
259 '
260
261
262 test_expect_success 'prepare for several edits' '
263 git reset --hard master &&
264 git checkout -b several_edits &&
265 test_commit one_edits main.txt one &&
266 test_commit two_edits main.txt two &&
267 test_commit three_edits main.txt three &&
268 test_commit four_edits main.txt four
269 '
270
271
272 test_expect_success 'status: (continue first edit) second edit' '
273 FAKE_LINES="edit 1 edit 2 3" &&
274 export FAKE_LINES &&
275 test_when_finished "git rebase --abort" &&
276 ONTO=$(git rev-parse --short HEAD~3) &&
277 git rebase -i HEAD~3 &&
278 git rebase --continue &&
279 cat >expected <<EOF &&
280 rebase in progress; onto $ONTO
281 You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
282 (use "git commit --amend" to amend the current commit)
283 (use "git rebase --continue" once you are satisfied with your changes)
284
285 nothing to commit (use -u to show untracked files)
286 EOF
287 git status --untracked-files=no >actual &&
288 test_i18ncmp expected actual
289 '
290
291
292 test_expect_success 'status: (continue first edit) second edit and split' '
293 git reset --hard several_edits &&
294 FAKE_LINES="edit 1 edit 2 3" &&
295 export FAKE_LINES &&
296 test_when_finished "git rebase --abort" &&
297 ONTO=$(git rev-parse --short HEAD~3) &&
298 git rebase -i HEAD~3 &&
299 git rebase --continue &&
300 git reset HEAD^ &&
301 cat >expected <<EOF &&
302 rebase in progress; onto $ONTO
303 You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
304 (Once your working directory is clean, run "git rebase --continue")
305
306 Changes not staged for commit:
307 (use "git add <file>..." to update what will be committed)
308 (use "git checkout -- <file>..." to discard changes in working directory)
309
310 modified: main.txt
311
312 no changes added to commit (use "git add" and/or "git commit -a")
313 EOF
314 git status --untracked-files=no >actual &&
315 test_i18ncmp expected actual
316 '
317
318
319 test_expect_success 'status: (continue first edit) second edit and amend' '
320 git reset --hard several_edits &&
321 FAKE_LINES="edit 1 edit 2 3" &&
322 export FAKE_LINES &&
323 test_when_finished "git rebase --abort" &&
324 ONTO=$(git rev-parse --short HEAD~3) &&
325 git rebase -i HEAD~3 &&
326 git rebase --continue &&
327 git commit --amend -m "foo" &&
328 cat >expected <<EOF &&
329 rebase in progress; onto $ONTO
330 You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
331 (use "git commit --amend" to amend the current commit)
332 (use "git rebase --continue" once you are satisfied with your changes)
333
334 nothing to commit (use -u to show untracked files)
335 EOF
336 git status --untracked-files=no >actual &&
337 test_i18ncmp expected actual
338 '
339
340
341 test_expect_success 'status: (amend first edit) second edit' '
342 git reset --hard several_edits &&
343 FAKE_LINES="edit 1 edit 2 3" &&
344 export FAKE_LINES &&
345 test_when_finished "git rebase --abort" &&
346 ONTO=$(git rev-parse --short HEAD~3) &&
347 git rebase -i HEAD~3 &&
348 git commit --amend -m "a" &&
349 git rebase --continue &&
350 cat >expected <<EOF &&
351 rebase in progress; onto $ONTO
352 You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
353 (use "git commit --amend" to amend the current commit)
354 (use "git rebase --continue" once you are satisfied with your changes)
355
356 nothing to commit (use -u to show untracked files)
357 EOF
358 git status --untracked-files=no >actual &&
359 test_i18ncmp expected actual
360 '
361
362
363 test_expect_success 'status: (amend first edit) second edit and split' '
364 git reset --hard several_edits &&
365 FAKE_LINES="edit 1 edit 2 3" &&
366 export FAKE_LINES &&
367 test_when_finished "git rebase --abort" &&
368 ONTO=$(git rev-parse --short HEAD~3) &&
369 git rebase -i HEAD~3 &&
370 git commit --amend -m "b" &&
371 git rebase --continue &&
372 git reset HEAD^ &&
373 cat >expected <<EOF &&
374 rebase in progress; onto $ONTO
375 You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
376 (Once your working directory is clean, run "git rebase --continue")
377
378 Changes not staged for commit:
379 (use "git add <file>..." to update what will be committed)
380 (use "git checkout -- <file>..." to discard changes in working directory)
381
382 modified: main.txt
383
384 no changes added to commit (use "git add" and/or "git commit -a")
385 EOF
386 git status --untracked-files=no >actual &&
387 test_i18ncmp expected actual
388 '
389
390
391 test_expect_success 'status: (amend first edit) second edit and amend' '
392 git reset --hard several_edits &&
393 FAKE_LINES="edit 1 edit 2 3" &&
394 export FAKE_LINES &&
395 test_when_finished "git rebase --abort" &&
396 ONTO=$(git rev-parse --short HEAD~3) &&
397 git rebase -i HEAD~3 &&
398 git commit --amend -m "c" &&
399 git rebase --continue &&
400 git commit --amend -m "d" &&
401 cat >expected <<EOF &&
402 rebase in progress; onto $ONTO
403 You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
404 (use "git commit --amend" to amend the current commit)
405 (use "git rebase --continue" once you are satisfied with your changes)
406
407 nothing to commit (use -u to show untracked files)
408 EOF
409 git status --untracked-files=no >actual &&
410 test_i18ncmp expected actual
411 '
412
413
414 test_expect_success 'status: (split first edit) second edit' '
415 git reset --hard several_edits &&
416 FAKE_LINES="edit 1 edit 2 3" &&
417 export FAKE_LINES &&
418 test_when_finished "git rebase --abort" &&
419 ONTO=$(git rev-parse --short HEAD~3) &&
420 git rebase -i HEAD~3 &&
421 git reset HEAD^ &&
422 git add main.txt &&
423 git commit -m "e" &&
424 git rebase --continue &&
425 cat >expected <<EOF &&
426 rebase in progress; onto $ONTO
427 You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
428 (use "git commit --amend" to amend the current commit)
429 (use "git rebase --continue" once you are satisfied with your changes)
430
431 nothing to commit (use -u to show untracked files)
432 EOF
433 git status --untracked-files=no >actual &&
434 test_i18ncmp expected actual
435 '
436
437
438 test_expect_success 'status: (split first edit) second edit and split' '
439 git reset --hard several_edits &&
440 FAKE_LINES="edit 1 edit 2 3" &&
441 export FAKE_LINES &&
442 test_when_finished "git rebase --abort" &&
443 ONTO=$(git rev-parse --short HEAD~3) &&
444 git rebase -i HEAD~3 &&
445 git reset HEAD^ &&
446 git add main.txt &&
447 git commit --amend -m "f" &&
448 git rebase --continue &&
449 git reset HEAD^ &&
450 cat >expected <<EOF &&
451 rebase in progress; onto $ONTO
452 You are currently splitting a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
453 (Once your working directory is clean, run "git rebase --continue")
454
455 Changes not staged for commit:
456 (use "git add <file>..." to update what will be committed)
457 (use "git checkout -- <file>..." to discard changes in working directory)
458
459 modified: main.txt
460
461 no changes added to commit (use "git add" and/or "git commit -a")
462 EOF
463 git status --untracked-files=no >actual &&
464 test_i18ncmp expected actual
465 '
466
467
468 test_expect_success 'status: (split first edit) second edit and amend' '
469 git reset --hard several_edits &&
470 FAKE_LINES="edit 1 edit 2 3" &&
471 export FAKE_LINES &&
472 test_when_finished "git rebase --abort" &&
473 ONTO=$(git rev-parse --short HEAD~3) &&
474 git rebase -i HEAD~3 &&
475 git reset HEAD^ &&
476 git add main.txt &&
477 git commit --amend -m "g" &&
478 git rebase --continue &&
479 git commit --amend -m "h" &&
480 cat >expected <<EOF &&
481 rebase in progress; onto $ONTO
482 You are currently editing a commit while rebasing branch '\''several_edits'\'' on '\''$ONTO'\''.
483 (use "git commit --amend" to amend the current commit)
484 (use "git rebase --continue" once you are satisfied with your changes)
485
486 nothing to commit (use -u to show untracked files)
487 EOF
488 git status --untracked-files=no >actual &&
489 test_i18ncmp expected actual
490 '
491
492
493 test_expect_success 'prepare am_session' '
494 git reset --hard master &&
495 git checkout -b am_session &&
496 test_commit one_am one.txt "one" &&
497 test_commit two_am two.txt "two" &&
498 test_commit three_am three.txt "three"
499 '
500
501
502 test_expect_success 'status in an am session: file already exists' '
503 git checkout -b am_already_exists &&
504 test_when_finished "rm Maildir/* && git am --abort" &&
505 git format-patch -1 -oMaildir &&
506 test_must_fail git am Maildir/*.patch &&
507 cat >expected <<\EOF &&
508 On branch am_already_exists
509 You are in the middle of an am session.
510 (fix conflicts and then run "git am --continue")
511 (use "git am --skip" to skip this patch)
512 (use "git am --abort" to restore the original branch)
513
514 nothing to commit (use -u to show untracked files)
515 EOF
516 git status --untracked-files=no >actual &&
517 test_i18ncmp expected actual
518 '
519
520
521 test_expect_success 'status in an am session: file does not exist' '
522 git reset --hard am_session &&
523 git checkout -b am_not_exists &&
524 git rm three.txt &&
525 git commit -m "delete three.txt" &&
526 test_when_finished "rm Maildir/* && git am --abort" &&
527 git format-patch -1 -oMaildir &&
528 test_must_fail git am Maildir/*.patch &&
529 cat >expected <<\EOF &&
530 On branch am_not_exists
531 You are in the middle of an am session.
532 (fix conflicts and then run "git am --continue")
533 (use "git am --skip" to skip this patch)
534 (use "git am --abort" to restore the original branch)
535
536 nothing to commit (use -u to show untracked files)
537 EOF
538 git status --untracked-files=no >actual &&
539 test_i18ncmp expected actual
540 '
541
542
543 test_expect_success 'status in an am session: empty patch' '
544 git reset --hard am_session &&
545 git checkout -b am_empty &&
546 test_when_finished "rm Maildir/* && git am --abort" &&
547 git format-patch -3 -oMaildir &&
548 git rm one.txt two.txt three.txt &&
549 git commit -m "delete all am_empty" &&
550 echo error >Maildir/0002-two_am.patch &&
551 test_must_fail git am Maildir/*.patch &&
552 cat >expected <<\EOF &&
553 On branch am_empty
554 You are in the middle of an am session.
555 The current patch is empty.
556 (use "git am --skip" to skip this patch)
557 (use "git am --abort" to restore the original branch)
558
559 nothing to commit (use -u to show untracked files)
560 EOF
561 git status --untracked-files=no >actual &&
562 test_i18ncmp expected actual
563 '
564
565
566 test_expect_success 'status when bisecting' '
567 git reset --hard master &&
568 git checkout -b bisect &&
569 test_commit one_bisect main.txt one &&
570 test_commit two_bisect main.txt two &&
571 test_commit three_bisect main.txt three &&
572 test_when_finished "git bisect reset" &&
573 git bisect start &&
574 git bisect bad &&
575 git bisect good one_bisect &&
576 TGT=$(git rev-parse --short two_bisect) &&
577 cat >expected <<EOF &&
578 HEAD detached at $TGT
579 You are currently bisecting, started from branch '\''bisect'\''.
580 (use "git bisect reset" to get back to the original branch)
581
582 nothing to commit (use -u to show untracked files)
583 EOF
584 git status --untracked-files=no >actual &&
585 test_i18ncmp expected actual
586 '
587
588
589 test_expect_success 'status when rebase conflicts with statushints disabled' '
590 git reset --hard master &&
591 git checkout -b statushints_disabled &&
592 test_when_finished "git config --local advice.statushints true" &&
593 git config --local advice.statushints false &&
594 test_commit one_statushints main.txt one &&
595 test_commit two_statushints main.txt two &&
596 test_commit three_statushints main.txt three &&
597 test_when_finished "git rebase --abort" &&
598 ONTO=$(git rev-parse --short HEAD^^) &&
599 test_must_fail git rebase HEAD^ --onto HEAD^^ &&
600 cat >expected <<EOF &&
601 rebase in progress; onto $ONTO
602 You are currently rebasing branch '\''statushints_disabled'\'' on '\''$ONTO'\''.
603
604 Unmerged paths:
605 both modified: main.txt
606
607 no changes added to commit
608 EOF
609 git status --untracked-files=no >actual &&
610 test_i18ncmp expected actual
611 '
612
613
614 test_expect_success 'prepare for cherry-pick conflicts' '
615 git reset --hard master &&
616 git checkout -b cherry_branch &&
617 test_commit one_cherry main.txt one &&
618 test_commit two_cherries main.txt two &&
619 git checkout -b cherry_branch_second &&
620 test_commit second_cherry main.txt second &&
621 git checkout cherry_branch &&
622 test_commit three_cherries main.txt three
623 '
624
625
626 test_expect_success 'status when cherry-picking before resolving conflicts' '
627 test_when_finished "git cherry-pick --abort" &&
628 test_must_fail git cherry-pick cherry_branch_second &&
629 TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) &&
630 cat >expected <<EOF &&
631 On branch cherry_branch
632 You are currently cherry-picking commit $TO_CHERRY_PICK.
633 (fix conflicts and run "git cherry-pick --continue")
634 (use "git cherry-pick --abort" to cancel the cherry-pick operation)
635
636 Unmerged paths:
637 (use "git add <file>..." to mark resolution)
638
639 both modified: main.txt
640
641 no changes added to commit (use "git add" and/or "git commit -a")
642 EOF
643 git status --untracked-files=no >actual &&
644 test_i18ncmp expected actual
645 '
646
647
648 test_expect_success 'status when cherry-picking after resolving conflicts' '
649 git reset --hard cherry_branch &&
650 test_when_finished "git cherry-pick --abort" &&
651 test_must_fail git cherry-pick cherry_branch_second &&
652 TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) &&
653 echo end >main.txt &&
654 git add main.txt &&
655 cat >expected <<EOF &&
656 On branch cherry_branch
657 You are currently cherry-picking commit $TO_CHERRY_PICK.
658 (all conflicts fixed: run "git cherry-pick --continue")
659 (use "git cherry-pick --abort" to cancel the cherry-pick operation)
660
661 Changes to be committed:
662
663 modified: main.txt
664
665 Untracked files not listed (use -u option to show untracked files)
666 EOF
667 git status --untracked-files=no >actual &&
668 test_i18ncmp expected actual
669 '
670
671 test_expect_success 'status showing detached at and from a tag' '
672 test_commit atag tagging &&
673 git checkout atag &&
674 cat >expected <<\EOF &&
675 HEAD detached at atag
676 nothing to commit (use -u to show untracked files)
677 EOF
678 git status --untracked-files=no >actual &&
679 test_i18ncmp expected actual &&
680
681 git reset --hard HEAD^ &&
682 cat >expected <<\EOF &&
683 HEAD detached from atag
684 nothing to commit (use -u to show untracked files)
685 EOF
686 git status --untracked-files=no >actual &&
687 test_i18ncmp expected actual
688 '
689
690 test_expect_success 'status while reverting commit (conflicts)' '
691 git checkout master &&
692 echo before >to-revert.txt &&
693 test_commit before to-revert.txt &&
694 echo old >to-revert.txt &&
695 test_commit old to-revert.txt &&
696 echo new >to-revert.txt &&
697 test_commit new to-revert.txt &&
698 TO_REVERT=$(git rev-parse --short HEAD^) &&
699 test_must_fail git revert $TO_REVERT &&
700 cat >expected <<EOF &&
701 On branch master
702 You are currently reverting commit $TO_REVERT.
703 (fix conflicts and run "git revert --continue")
704 (use "git revert --abort" to cancel the revert operation)
705
706 Unmerged paths:
707 (use "git reset HEAD <file>..." to unstage)
708 (use "git add <file>..." to mark resolution)
709
710 both modified: to-revert.txt
711
712 no changes added to commit (use "git add" and/or "git commit -a")
713 EOF
714 git status --untracked-files=no >actual &&
715 test_i18ncmp expected actual
716 '
717
718 test_expect_success 'status while reverting commit (conflicts resolved)' '
719 echo reverted >to-revert.txt &&
720 git add to-revert.txt &&
721 cat >expected <<EOF &&
722 On branch master
723 You are currently reverting commit $TO_REVERT.
724 (all conflicts fixed: run "git revert --continue")
725 (use "git revert --abort" to cancel the revert operation)
726
727 Changes to be committed:
728 (use "git reset HEAD <file>..." to unstage)
729
730 modified: to-revert.txt
731
732 Untracked files not listed (use -u option to show untracked files)
733 EOF
734 git status --untracked-files=no >actual &&
735 test_i18ncmp expected actual
736 '
737
738 test_expect_success 'status after reverting commit' '
739 git revert --continue &&
740 cat >expected <<\EOF &&
741 On branch master
742 nothing to commit (use -u to show untracked files)
743 EOF
744 git status --untracked-files=no >actual &&
745 test_i18ncmp expected actual
746 '
747
748 test_done