Skip to content

Commit 2b4714b

Browse files
committed
t3701-add-interactive: test add_i_show_help()
Add test to t3701-add-interactive to verify that add_i_show_help() outputs expected content. Also, add it before changing git-add--interactive.perl's help_cmd to demonstrate that there are no changes introduced by the conversion to C. Prefix git add -i call with GIT_PAGER_IN_USE=true TERM=vt100 to force colored output on Windows. Signed-off-by: Slavica Djukic <[email protected]>
1 parent cf4e913 commit 2b4714b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

t/t3701-add-interactive.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,4 +639,28 @@ test_expect_success 'add -p patch editing works with pathological context lines'
639639
test_cmp expected-2 actual
640640
'
641641

642+
test_expect_success 'show help from add--helper' '
643+
git reset --hard &&
644+
cat >expect <<-\EOF &&
645+
646+
<BOLD>*** Commands ***<RESET>
647+
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
648+
5: <BOLD;BLUE>p<RESET>atch 6: <BOLD;BLUE>d<RESET>iff 7: <BOLD;BLUE>q<RESET>uit 8: <BOLD;BLUE>h<RESET>elp
649+
<BOLD;BLUE>What now<RESET>> <BOLD;RED>status - show paths with changes<RESET>
650+
<BOLD;RED>update - add working tree state to the staged set of changes<RESET>
651+
<BOLD;RED>revert - revert staged set of changes back to the HEAD version<RESET>
652+
<BOLD;RED>patch - pick hunks and update selectively<RESET>
653+
<BOLD;RED>diff - view diff between HEAD and index<RESET>
654+
<BOLD;RED>add untracked - add contents of untracked files to the staged set of changes<RESET>
655+
<BOLD>*** Commands ***<RESET>
656+
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
657+
5: <BOLD;BLUE>p<RESET>atch 6: <BOLD;BLUE>d<RESET>iff 7: <BOLD;BLUE>q<RESET>uit 8: <BOLD;BLUE>h<RESET>elp
658+
<BOLD;BLUE>What now<RESET>>
659+
Bye.
660+
EOF
661+
test_write_lines h | GIT_PAGER_IN_USE=true TERM=vt100 git add -i >actual.colored &&
662+
test_decode_color <actual.colored >actual &&
663+
test_i18ncmp expect actual
664+
'
665+
642666
test_done

0 commit comments

Comments
 (0)