3 test_description
='add -i basic tests'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 .
"$TEST_DIRECTORY"/lib-terminal.sh
10 if ! test_have_prereq PERL
12 skip_all
='skipping add -i tests, perl not available'
19 sed -e '/^index/s/[0-9a-f]*[1-9a-f][0-9a-f]*\.\./1234567../' \
20 -e '/^index/s/\.\.[0-9a-f]*[1-9a-f][0-9a-f]*/..9abcdef/' \
21 -e '/^index/s/ 00*\.\./ 0000000../' \
22 -e '/^index/s/\.\.00*$/..0000000/' \
23 -e '/^index/s/\.\.00* /..0000000 /' \
26 test_cmp
"$1.filtered" "$2.filtered"
29 # This function uses a trick to manipulate the interactive add to use color:
30 # the `want_color()` function special-cases the situation where a pager was
31 # spawned and Git now wants to output colored text: to detect that situation,
32 # the environment variable `GIT_PAGER_IN_USE` is set. However, color is
33 # suppressed despite that environment variable if the `TERM` variable
34 # indicates a dumb terminal, so we set that variable, too.
37 # The first element of $@ may be a shell function, as a result POSIX
38 # does not guarantee that "one-shot assignment" will not persist after
39 # the function call. Thus, we prevent these variables from escaping
40 # this function's context with this subshell.
42 GIT_PAGER_IN_USE
=true
&&
44 export GIT_PAGER_IN_USE TERM
&&
49 test_expect_success
'setup (initial)' '
55 test_expect_success
'status works (initial)' '
56 git add -i </dev/null >output &&
57 grep "+1/-0 *+2/-0 file" output
60 test_expect_success
'setup expected' '
63 index 0000000..d95f3ad
71 test_expect_success
'diff works (initial)' '
72 test_write_lines d 1 | git add -i >output &&
73 sed -ne "/new file/,/content/p" <output >diff &&
74 diff_cmp expected diff
76 test_expect_success
'revert works (initial)' '
78 test_write_lines r 1 | git add -i &&
79 git ls-files >output &&
83 test_expect_success
'add untracked (multiple)' '
84 test_when_finished "git reset && rm [1-9]" &&
85 touch $(test_seq 9) &&
86 test_write_lines a "2-5 8-" | git add -i -- [1-9] &&
87 test_write_lines 2 3 4 5 8 9 >expected &&
88 git ls-files [1-9] >output &&
89 test_cmp expected output
92 test_expect_success
'setup (commit)' '
93 echo baseline >file &&
95 git commit -m commit &&
96 echo content >>file &&
101 test_expect_success
'status works (commit)' '
102 git add -i </dev/null >output &&
103 grep "+1/-0 *+2/-0 file" output
106 test_expect_success
'setup expected' '
107 cat >expected <<-\EOF
108 index 180b47c..b6f2c08 100644
117 test_expect_success
'diff works (commit)' '
118 test_write_lines d 1 | git add -i >output &&
119 sed -ne "/^index/,/content/p" <output >diff &&
120 diff_cmp expected diff
122 test_expect_success
'revert works (commit)' '
124 test_write_lines r 1 | git add -i &&
125 git add -i </dev/null >output &&
126 grep "unchanged *+3/-0 file" output
129 test_expect_success
'setup expected' '
130 cat >expected <<-\EOF
134 test_expect_success
'dummy edit works' '
136 test_write_lines e a | git add -p &&
138 diff_cmp expected diff
141 test_expect_success
'setup patch' '
151 test_expect_success
'setup fake editor' '
152 write_script "fake_editor.sh" <<-\EOF &&
153 mv -f "$1" oldpatch &&
156 test_set_editor "$(pwd)/fake_editor.sh"
159 test_expect_success
'bad edit rejected' '
161 test_write_lines e n d | git add -p >output &&
162 grep "hunk does not apply" output
165 test_expect_success
'setup patch' '
172 test_expect_success
'garbage edit rejected' '
174 test_write_lines e n d | git add -p >output &&
175 grep "hunk does not apply" output
178 test_expect_success
'setup patch' '
188 test_expect_success
'setup expected' '
189 cat >expected <<-\EOF
190 diff --git a/file b/file
191 index b5dd6c9..f910ae9 100644
203 test_expect_success
'real edit works' '
204 test_write_lines e n d | git add -p &&
206 diff_cmp expected output
209 test_expect_success
'setup file' '
210 test_write_lines a "" b "" c >file &&
212 test_write_lines a "" d "" c >file
215 test_expect_success
'setup patch' '
229 test_expect_success
'setup expected' '
231 diff --git a/file b/file
232 index b5dd6c9..f910ae9 100644
245 test_expect_success
'edit can strip spaces from empty context lines' '
246 test_write_lines e n q | git add -p 2>error &&
247 test_must_be_empty error &&
249 diff_cmp expected output
252 test_expect_success
'skip files similarly as commit -a' '
254 echo file >.gitignore &&
255 echo changed >file &&
256 echo y | git add -p file &&
259 git commit -am commit &&
260 git diff >expected &&
261 diff_cmp expected output &&
262 git reset --hard HEAD^
266 test_expect_success FILEMODE
'patch does not affect mode' '
268 echo content >>file &&
270 printf "n\\ny\\n" | git add -p &&
271 git show :file | grep content &&
272 git diff file | grep "new mode"
275 test_expect_success FILEMODE
'stage mode but not hunk' '
277 echo content >>file &&
279 printf "y\\nn\\n" | git add -p &&
280 git diff --cached file | grep "new mode" &&
281 git diff file | grep "+content"
285 test_expect_success FILEMODE
'stage mode and hunk' '
287 echo content >>file &&
289 printf "y\\ny\\n" | git add -p &&
290 git diff --cached file | grep "new mode" &&
291 git diff --cached file | grep "+content" &&
292 test -z "$(git diff file)"
295 # end of tests disabled when filemode is not usable
297 test_expect_success
'different prompts for mode change/deleted' '
301 git add --chmod=+x file deleted &&
302 echo changed >file &&
304 test_write_lines n n n |
305 git -c core.filemode=true add -p >actual &&
306 sed -n "s/^\(([0-9/]*) Stage .*?\).*/\1/p" actual >actual.filtered &&
307 cat >expect <<-\EOF &&
308 (1/1) Stage deletion [y,n,q,a,d,?]?
309 (1/2) Stage mode change [y,n,q,a,d,j,J,g,/,?]?
310 (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]?
312 test_cmp expect actual.filtered
315 test_expect_success
'correct message when there is nothing to do' '
318 test_i18ngrep "No changes" err &&
319 printf "\\0123" >binary &&
321 printf "\\0abc" >binary &&
323 test_i18ngrep "Only binary files changed" err
326 test_expect_success
'setup again' '
328 test_chmod +x file &&
332 # Write the patch file with a new line at the top and bottom
333 test_expect_success
'setup patch' '
335 index 180b47c..b6f2c08 100644
343 \ No newline at end of file
347 # Expected output, diff is similar to the patch but w/ diff at the top
348 test_expect_success
'setup expected' '
349 echo diff --git a/file b/file >expected &&
350 cat patch |sed "/^index/s/ 100644/ 100755/" >>expected &&
351 cat >expected-output <<-\EOF
359 \ No newline at end of file
368 \ No newline at end of file
372 # Test splitting the first patch, then adding both
373 test_expect_success
'add first line works' '
374 git commit -am "clear local changes" &&
376 printf "%s\n" s y y | git add -p file 2>error |
377 sed -n -e "s/^([1-2]\/[1-2]) Stage this hunk[^@]*\(@@ .*\)/\1/" \
378 -e "/^[-+@ \\\\]"/p >output &&
379 test_must_be_empty error &&
380 git diff --cached >diff &&
381 diff_cmp expected diff &&
382 test_cmp expected-output output
385 test_expect_success
'setup expected' '
386 cat >expected <<-\EOF
387 diff --git a/non-empty b/non-empty
388 deleted file mode 100644
389 index d95f3ad..0000000
397 test_expect_success
'deleting a non-empty file' '
399 echo content >non-empty &&
401 git commit -m non-empty &&
403 echo y | git add -p non-empty &&
404 git diff --cached >diff &&
405 diff_cmp expected diff
408 test_expect_success
'setup expected' '
409 cat >expected <<-\EOF
410 diff --git a/empty b/empty
411 deleted file mode 100644
412 index e69de29..0000000
416 test_expect_success
'deleting an empty file' '
420 git commit -m empty &&
422 echo y | git add -p empty &&
423 git diff --cached >diff &&
424 diff_cmp expected diff
427 test_expect_success
'adding an empty file' '
431 test_commit initial &&
435 git commit -m empty &&
436 git tag added-file &&
437 git reset --hard HEAD^ &&
438 test_path_is_missing empty &&
440 echo y | git checkout -p added-file -- >actual &&
441 test_path_is_file empty &&
442 test_i18ngrep "Apply addition to index and worktree" actual
446 test_expect_success
'split hunk setup' '
448 test_write_lines 10 20 30 40 50 60 >test &&
451 git commit -m test &&
453 test_write_lines 10 15 20 21 22 23 24 30 40 50 60 >test
456 test_expect_success
'goto hunk' '
457 test_when_finished "git reset" &&
458 tr _ " " >expect <<-EOF &&
459 (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]? + 1: -1,2 +1,3 +15
461 go to which hunk? @@ -1,2 +1,3 @@
465 (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]?_
467 test_write_lines s y g 1 | git add -p >actual &&
468 tail -n 7 <actual >actual.trimmed &&
469 test_cmp expect actual.trimmed
472 test_expect_success
'navigate to hunk via regex' '
473 test_when_finished "git reset" &&
474 tr _ " " >expect <<-EOF &&
475 (2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]? @@ -1,2 +1,3 @@
479 (1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]?_
481 test_write_lines s y /1,2 | git add -p >actual &&
482 tail -n 5 <actual >actual.trimmed &&
483 test_cmp expect actual.trimmed
486 test_expect_success
'split hunk "add -p (edit)"' '
487 # Split, say Edit and do nothing. Then:
489 # 1. Broken version results in a patch that does not apply and
490 # only takes [y/n] (edit again) so the first q is discarded
491 # and then n attempts to discard the edit. Repeat q enough
494 # 2. Correct version applies the (not)edited version, and asks
495 # about the next hunk, against which we say q and program
497 printf "%s\n" s e q n q q |
498 EDITOR=: git add -p &&
503 test_expect_failure
'split hunk "add -p (no, yes, edit)"' '
504 test_write_lines 5 10 20 21 30 31 40 50 60 >test &&
506 # test sequence is s(plit), n(o), y(es), e(dit)
507 # q n q q is there to make sure we exit at the end.
508 printf "%s\n" s n y e q n q q |
509 EDITOR=: git add -p 2>error &&
510 test_must_be_empty error &&
515 test_expect_success
'split hunk with incomplete line at end' '
517 printf "missing LF" >>test &&
519 test_write_lines before 10 20 30 40 50 60 70 >test &&
520 git grep --cached missing &&
521 test_write_lines s n y q | git add -p &&
522 test_must_fail git grep --cached missing &&
524 test_must_fail git grep --cached before
527 test_expect_failure
'edit, adding lines to the first hunk' '
528 test_write_lines 10 11 20 30 40 50 51 60 >test &&
530 tr _ " " >patch <<-EOF &&
540 # test sequence is s(plit), e(dit), n(o)
541 # q n q q is there to make sure we exit at the end.
542 printf "%s\n" s e n q n q q |
543 EDITOR=./fake_editor.sh git add -p 2>error &&
544 test_must_be_empty error &&
545 git diff --cached >actual &&
549 test_expect_success
'patch mode ignores unmerged entries' '
551 test_commit conflict &&
552 test_commit non-conflict &&
553 git checkout -b side &&
554 test_commit side conflict.t &&
556 test_commit main conflict.t &&
557 test_must_fail git merge side &&
558 echo changed >non-conflict.t &&
559 echo y | git add -p >output &&
560 ! grep a/conflict.t output &&
561 cat >expected <<-\EOF &&
562 * Unmerged path conflict.t
563 diff --git a/non-conflict.t b/non-conflict.t
564 index f766221..5ea2ed4 100644
571 git diff --cached >diff &&
572 diff_cmp expected diff
575 test_expect_success
'index is refreshed after applying patch' '
577 echo content >test &&
578 printf y | git add -p &&
579 git diff-files --exit-code
582 test_expect_success
'diffs can be colorized' '
585 echo content >test &&
587 force_color git add -p >output 2>&1 <y &&
588 git diff-files --exit-code &&
590 # We do not want to depend on the exact coloring scheme
591 # git uses for diffs, so just check that we saw some kind of color.
592 grep "$(printf "\\033")" output
595 test_expect_success
'colors can be overridden' '
597 test_when_finished "git rm -f color-test" &&
598 test_write_lines context old more-context >color-test &&
599 git add color-test &&
600 test_write_lines context new more-context another-one >color-test &&
602 echo trigger an error message >input &&
604 -c color.interactive.error=blue \
605 add -i 2>err.raw <input &&
606 test_decode_color <err.raw >err &&
607 grep "<BLUE>Huh (trigger)?<RESET>" err &&
609 test_write_lines help quit >input &&
611 -c color.interactive.header=red \
612 -c color.interactive.help=green \
613 -c color.interactive.prompt=yellow \
614 add -i >actual.raw <input &&
615 test_decode_color <actual.raw >actual &&
616 cat >expect <<-\EOF &&
617 <RED> staged unstaged path<RESET>
618 1: +3/-0 +2/-1 color-test
620 <RED>*** Commands ***<RESET>
621 1: <YELLOW>s<RESET>tatus 2: <YELLOW>u<RESET>pdate 3: <YELLOW>r<RESET>evert 4: <YELLOW>a<RESET>dd untracked
622 5: <YELLOW>p<RESET>atch 6: <YELLOW>d<RESET>iff 7: <YELLOW>q<RESET>uit 8: <YELLOW>h<RESET>elp
623 <YELLOW>What now<RESET>> <GREEN>status - show paths with changes<RESET>
624 <GREEN>update - add working tree state to the staged set of changes<RESET>
625 <GREEN>revert - revert staged set of changes back to the HEAD version<RESET>
626 <GREEN>patch - pick hunks and update selectively<RESET>
627 <GREEN>diff - view diff between HEAD and index<RESET>
628 <GREEN>add untracked - add contents of untracked files to the staged set of changes<RESET>
629 <RED>*** Commands ***<RESET>
630 1: <YELLOW>s<RESET>tatus 2: <YELLOW>u<RESET>pdate 3: <YELLOW>r<RESET>evert 4: <YELLOW>a<RESET>dd untracked
631 5: <YELLOW>p<RESET>atch 6: <YELLOW>d<RESET>iff 7: <YELLOW>q<RESET>uit 8: <YELLOW>h<RESET>elp
632 <YELLOW>What now<RESET>> Bye.
634 test_cmp expect actual &&
636 : exercise recolor_hunk by editing and then look at the hunk again &&
637 test_write_lines s e K q >input &&
639 -c color.interactive.prompt=yellow \
640 -c color.diff.meta=italic \
641 -c color.diff.frag=magenta \
642 -c color.diff.context=cyan \
643 -c color.diff.old=bold \
644 -c color.diff.new=blue \
645 -c core.editor=touch \
646 add -p >actual.raw <input &&
647 test_decode_color <actual.raw >actual.decoded &&
648 sed "s/index [0-9a-f]*\\.\\.[0-9a-f]* 100644/<INDEX-LINE>/" <actual.decoded >actual &&
649 cat >expect <<-\EOF &&
650 <ITALIC>diff --git a/color-test b/color-test<RESET>
651 <ITALIC><INDEX-LINE><RESET>
652 <ITALIC>--- a/color-test<RESET>
653 <ITALIC>+++ b/color-test<RESET>
654 <MAGENTA>@@ -1,3 +1,4 @@<RESET>
655 <CYAN> context<RESET>
657 <BLUE>+<RESET><BLUE>new<RESET>
658 <CYAN> more-context<RESET>
659 <BLUE>+<RESET><BLUE>another-one<RESET>
660 <YELLOW>(1/1) Stage this hunk [y,n,q,a,d,s,e,?]? <RESET><BOLD>Split into 2 hunks.<RESET>
661 <MAGENTA>@@ -1,3 +1,3 @@<RESET>
662 <CYAN> context<RESET>
664 <BLUE>+<RESET><BLUE>new<RESET>
665 <CYAN> more-context<RESET>
666 <YELLOW>(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? <RESET><MAGENTA>@@ -3 +3,2 @@<RESET>
667 <CYAN> more-context<RESET>
668 <BLUE>+<RESET><BLUE>another-one<RESET>
669 <YELLOW>(2/2) Stage this hunk [y,n,q,a,d,K,g,/,e,?]? <RESET><MAGENTA>@@ -1,3 +1,3 @@<RESET>
670 <CYAN> context<RESET>
673 <CYAN> more-context<RESET>
674 <YELLOW>(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? <RESET>
676 test_cmp expect actual
679 test_expect_success
'colorized diffs respect diff.wsErrorHighlight' '
687 force_color git -c diff.wsErrorHighlight=all add -p >output.raw 2>&1 <y &&
688 test_decode_color <output.raw >output &&
692 test_expect_success
'diffFilter filters diff' '
695 echo content >test &&
696 test_config interactive.diffFilter "sed s/^/foo:/" &&
698 force_color git add -p >output 2>&1 <y &&
700 # avoid depending on the exact coloring or content of the prompts,
701 # and just make sure we saw our diff prefixed
702 grep foo:.*content output
705 test_expect_success
'detect bogus diffFilter output' '
708 echo content >test &&
709 test_config interactive.diffFilter "sed 1d" &&
711 force_color test_must_fail git add -p <y
714 test_expect_success
'diff.algorithm is passed to `git diff-files`' '
719 echo changed >file &&
720 test_must_fail git -c diff.algorithm=bogus add -p 2>err &&
721 test_i18ngrep "error: option diff-algorithm accepts " err
724 test_expect_success
'patch-mode via -i prompts for files' '
729 git add -i <<-\EOF &&
738 git diff --cached --name-only >actual &&
739 diff_cmp expect actual
742 test_expect_success
'add -p handles globs' '
747 echo base >subdir/two.c &&
749 git commit -m base &&
751 echo change >one.c &&
752 echo change >subdir/two.c &&
753 git add -p "*.c" <<-\EOF &&
758 cat >expect <<-\EOF &&
762 git diff --cached --name-only >actual &&
763 test_cmp expect actual
766 test_expect_success
'add -p handles relative paths' '
769 echo base >relpath.c &&
771 git commit -m relpath &&
773 echo change >relpath.c &&
775 git -C subdir add -p .. 2>error <<-\EOF &&
779 test_must_be_empty error &&
781 cat >expect <<-\EOF &&
784 git diff --cached --name-only >actual &&
785 test_cmp expect actual
788 test_expect_success
'add -p does not expand argument lists' '
791 echo content >not-changed &&
792 git add not-changed &&
793 git commit -m "add not-changed file" &&
796 GIT_TRACE=$(pwd)/trace.out git add -p . <<-\EOF &&
800 # we know that "file" must be mentioned since we actually
801 # update it, but we want to be sure that our "." pathspec
802 # was not expanded into the argument list of any command.
803 # So look only for "not-changed".
804 ! grep -E "^trace: (built-in|exec|run_command): .*not-changed" trace.out
807 test_expect_success
'hunk-editing handles custom comment char' '
809 echo change >>file &&
810 test_config core.commentChar "\$" &&
811 echo e | GIT_EDITOR=true git add -p &&
815 test_expect_success
'add -p works even with color.ui=always' '
817 echo change >>file &&
818 test_config color.ui always &&
819 echo y | git add -p &&
821 git diff --cached --name-only >actual &&
822 test_cmp expect actual
825 test_expect_success
'setup different kinds of dirty submodules' '
826 test_create_repo for-submodules &&
829 test_commit initial &&
830 test_create_repo dirty-head &&
835 cp -R dirty-head dirty-otherwise &&
836 cp -R dirty-head dirty-both-ways &&
837 git add dirty-head &&
838 git add dirty-otherwise dirty-both-ways &&
839 git commit -m initial &&
842 test_commit updated &&
843 cd ../dirty-both-ways &&
844 test_commit updated &&
845 echo dirty >>initial &&
847 cd ../dirty-otherwise &&
848 echo dirty >>initial &&
851 git -C for-submodules diff-files --name-only >actual &&
852 cat >expected <<-\EOF &&
856 test_cmp expected actual &&
857 git -C for-submodules diff-files --name-only --ignore-submodules=none >actual &&
858 cat >expected <<-\EOF &&
863 test_cmp expected actual &&
864 git -C for-submodules diff-files --name-only --ignore-submodules=dirty >actual &&
865 cat >expected <<-\EOF &&
869 test_cmp expected actual
872 test_expect_success
'status ignores dirty submodules (except HEAD)' '
873 git -C for-submodules add -i </dev/null >output &&
874 grep dirty-head output &&
875 grep dirty-both-ways output &&
876 ! grep dirty-otherwise output
879 test_expect_success
'set up pathological context' '
881 test_write_lines a a a a a a a a a a a >a &&
884 test_write_lines c b a a a a a a a b a a a a >a &&
885 test_write_lines a a a a a a a b a a a a >expected-1 &&
886 test_write_lines b a a a a a a a b a a a a >expected-2 &&
887 # check editing can cope with missing header and deleted context lines
888 # as well as changes to other lines
889 test_write_lines +b " a" >patch
892 test_expect_success
'add -p works with pathological context lines' '
896 git cat-file blob :a >actual &&
897 test_cmp expected-1 actual
900 test_expect_success
'add -p patch editing works with pathological context lines' '
902 # n q q below is in case edit fails
903 printf "%s\n" e y n q q |
905 git cat-file blob :a >actual &&
906 test_cmp expected-2 actual
909 test_expect_success
'checkout -p works with pathological context lines' '
910 test_write_lines a a a a a a >a &&
912 test_write_lines a b a b a b a b a b a >a &&
913 test_write_lines s n n y q | git checkout -p &&
914 test_write_lines a b a b a a b a b a >expect &&
918 # This should be called from a subshell as it sets a temporary editor
920 write_script new-file-editor.sh
<<-\EOF &&
921 sed /^#/d "$1" >patch &&
922 sed /^+c/d patch >"$1"
924 test_set_editor "$(pwd)/new-file-editor.sh" &&
925 test_write_lines a b c d e f >new-file &&
926 test_write_lines a b d e f >new-file-expect &&
927 test_write_lines "@@ -0,0 +1,6 @@" +a +b +c +d +e +f >patch-expect
930 test_expect_success 'add -N followed by add -p patch editing' '
934 git add -N new-file &&
935 test_write_lines e n q | git add -p &&
936 git cat-file blob :new-file >actual &&
937 test_cmp new-file-expect actual &&
938 test_cmp patch-expect patch
942 test_expect_success 'checkout -p patch editing of added file' '
947 git commit -m "add new file" &&
949 git commit -m "remove new file" &&
950 test_write_lines e n q | git checkout -p HEAD^ &&
951 test_cmp new-file-expect new-file &&
952 test_cmp patch-expect patch
956 test_expect_success 'show help from add--helper' '
958 cat >expect <<-EOF &&
960 <BOLD>*** Commands ***<RESET>
961 1: <BOLD;BLUE>s<RESET>tatus 2: <BOLD;BLUE>u<RESET>pdate 3: <BOLD;BLUE>r<RESET>evert 4: <BOLD;BLUE>a<RESET>dd untracked
962 5: <BOLD;BLUE>p<RESET>atch 6: <BOLD;BLUE>d<RESET>iff 7: <BOLD;BLUE>q<RESET>uit 8: <BOLD;BLUE>h<RESET>elp
963 <BOLD;BLUE>What now<RESET>> <BOLD;RED>status - show paths with changes
<RESET
>
964 <BOLD
;RED
>update
- add working tree state to the staged
set of changes
<RESET
>
965 <BOLD
;RED
>revert
- revert staged
set of changes back to the HEAD version
<RESET
>
966 <BOLD
;RED
>patch - pick hunks and update selectively
<RESET
>
967 <BOLD
;RED
>diff - view
diff between HEAD and index
<RESET
>
968 <BOLD
;RED
>add untracked
- add contents of untracked files to the staged
set of changes
<RESET
>
969 <BOLD
>*** Commands
***<RESET
>
970 1: <BOLD
;BLUE
>s
<RESET
>tatus
2: <BOLD
;BLUE
>u
<RESET
>pdate
3: <BOLD
;BLUE
>r
<RESET
>evert
4: <BOLD
;BLUE
>a
<RESET
>dd untracked
971 5: <BOLD
;BLUE
>p
<RESET
>atch
6: <BOLD
;BLUE
>d
<RESET
>iff
7: <BOLD
;BLUE
>q
<RESET
>uit
8: <BOLD
;BLUE
>h
<RESET
>elp
972 <BOLD
;BLUE
>What now
<RESET
>>$SP
975 test_write_lines h | force_color git add
-i >actual.colored
&&
976 test_decode_color
<actual.colored
>actual
&&
977 test_cmp expect actual