66test_description=' git status'
77
88. ./test-lib.sh
9+ . " $TEST_DIRECTORY " /lib-terminal.sh
910
1011test_expect_success ' status -h in broken repository' '
1112 git config --global advice.statusuoption false &&
@@ -667,7 +668,7 @@ test_expect_success 'setup unique colors' '
667668
668669'
669670
670- test_expect_success ' status with color.ui' '
671+ test_expect_success TTY ' status with color.ui' '
671672 cat >expect <<\EOF &&
672673On branch <GREEN>master<RESET>
673674Your branch and ' \' ' upstream' \' ' have diverged,
@@ -694,14 +695,14 @@ Untracked files:
694695 <BLUE>untracked<RESET>
695696
696697EOF
697- test_config color.ui always &&
698- git status | test_decode_color >output &&
698+ test_config color.ui auto &&
699+ test_terminal git status | test_decode_color >output &&
699700 test_i18ncmp expect output
700701'
701702
702- test_expect_success ' status with color.status' '
703- test_config color.status always &&
704- git status | test_decode_color >output &&
703+ test_expect_success TTY ' status with color.status' '
704+ test_config color.status auto &&
705+ test_terminal git status | test_decode_color >output &&
705706 test_i18ncmp expect output
706707'
707708
@@ -714,19 +715,19 @@ cat >expect <<\EOF
714715<BLUE>??<RESET> untracked
715716EOF
716717
717- test_expect_success ' status -s with color.ui' '
718+ test_expect_success TTY ' status -s with color.ui' '
718719
719- git config color.ui always &&
720- git status -s | test_decode_color >output &&
720+ git config color.ui auto &&
721+ test_terminal git status -s | test_decode_color >output &&
721722 test_cmp expect output
722723
723724'
724725
725- test_expect_success ' status -s with color.status' '
726+ test_expect_success TTY ' status -s with color.status' '
726727
727728 git config --unset color.ui &&
728- git config color.status always &&
729- git status -s | test_decode_color >output &&
729+ git config color.status auto &&
730+ test_terminal git status -s | test_decode_color >output &&
730731 test_cmp expect output
731732
732733'
@@ -741,9 +742,9 @@ cat >expect <<\EOF
741742<BLUE>??<RESET> untracked
742743EOF
743744
744- test_expect_success ' status -s -b with color.status' '
745+ test_expect_success TTY ' status -s -b with color.status' '
745746
746- git status -s -b | test_decode_color >output &&
747+ test_terminal git status -s -b | test_decode_color >output &&
747748 test_i18ncmp expect output
748749
749750'
@@ -757,20 +758,20 @@ A dir2/added
757758?? untracked
758759EOF
759760
760- test_expect_success ' status --porcelain ignores color.ui' '
761+ test_expect_success TTY ' status --porcelain ignores color.ui' '
761762
762763 git config --unset color.status &&
763- git config color.ui always &&
764- git status --porcelain | test_decode_color >output &&
764+ git config color.ui auto &&
765+ test_terminal git status --porcelain | test_decode_color >output &&
765766 test_cmp expect output
766767
767768'
768769
769- test_expect_success ' status --porcelain ignores color.status' '
770+ test_expect_success TTY ' status --porcelain ignores color.status' '
770771
771772 git config --unset color.ui &&
772- git config color.status always &&
773- git status --porcelain | test_decode_color >output &&
773+ git config color.status auto &&
774+ test_terminal git status --porcelain | test_decode_color >output &&
774775 test_cmp expect output
775776
776777'
0 commit comments