6
6
test_description=' git status'
7
7
8
8
. ./test-lib.sh
9
+ . " $TEST_DIRECTORY " /lib-terminal.sh
9
10
10
11
test_expect_success ' status -h in broken repository' '
11
12
git config --global advice.statusuoption false &&
@@ -667,7 +668,7 @@ test_expect_success 'setup unique colors' '
667
668
668
669
'
669
670
670
- test_expect_success ' status with color.ui' '
671
+ test_expect_success TTY ' status with color.ui' '
671
672
cat >expect <<\EOF &&
672
673
On branch <GREEN>master<RESET>
673
674
Your branch and ' \' ' upstream' \' ' have diverged,
@@ -694,14 +695,14 @@ Untracked files:
694
695
<BLUE>untracked<RESET>
695
696
696
697
EOF
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 &&
699
700
test_i18ncmp expect output
700
701
'
701
702
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 &&
705
706
test_i18ncmp expect output
706
707
'
707
708
@@ -714,19 +715,19 @@ cat >expect <<\EOF
714
715
<BLUE>??<RESET> untracked
715
716
EOF
716
717
717
- test_expect_success ' status -s with color.ui' '
718
+ test_expect_success TTY ' status -s with color.ui' '
718
719
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 &&
721
722
test_cmp expect output
722
723
723
724
'
724
725
725
- test_expect_success ' status -s with color.status' '
726
+ test_expect_success TTY ' status -s with color.status' '
726
727
727
728
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 &&
730
731
test_cmp expect output
731
732
732
733
'
@@ -741,9 +742,9 @@ cat >expect <<\EOF
741
742
<BLUE>??<RESET> untracked
742
743
EOF
743
744
744
- test_expect_success ' status -s -b with color.status' '
745
+ test_expect_success TTY ' status -s -b with color.status' '
745
746
746
- git status -s -b | test_decode_color >output &&
747
+ test_terminal git status -s -b | test_decode_color >output &&
747
748
test_i18ncmp expect output
748
749
749
750
'
@@ -757,20 +758,20 @@ A dir2/added
757
758
?? untracked
758
759
EOF
759
760
760
- test_expect_success ' status --porcelain ignores color.ui' '
761
+ test_expect_success TTY ' status --porcelain ignores color.ui' '
761
762
762
763
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 &&
765
766
test_cmp expect output
766
767
767
768
'
768
769
769
- test_expect_success ' status --porcelain ignores color.status' '
770
+ test_expect_success TTY ' status --porcelain ignores color.status' '
770
771
771
772
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 &&
774
775
test_cmp expect output
775
776
776
777
'
0 commit comments