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