@@ -98,6 +98,13 @@ test_expect_success 'fallback to color.ui' '
9898 grep "<BOLD;RED>error<RESET>: error" decoded
9999'
100100
101+ if test_have_prereq WITH_BREAKING_CHANGES
102+ then
103+ TURN_ON_SANITIZING=already.turned=on
104+ else
105+ TURN_ON_SANITIZING=sideband.allowControlCharacters=color
106+ fi
107+
101108test_expect_success ' disallow (color) control sequences in sideband' '
102109 write_script .git/color-me-surprised <<-\EOF &&
103110 printf "error: Have you \\033[31mread\\033[m this?\\a\\n" >&2
@@ -106,7 +113,7 @@ test_expect_success 'disallow (color) control sequences in sideband' '
106113 test_config_global uploadPack.packObjectsHook ./color-me-surprised &&
107114 test_commit need-at-least-one-commit &&
108115
109- git clone --no-local . throw-away 2>stderr &&
116+ git -c $TURN_ON_SANITIZING clone --no-local . throw-away 2>stderr &&
110117 test_decode_color <stderr >decoded &&
111118 test_grep RED decoded &&
112119 test_grep "\\^G" stderr &&
@@ -138,7 +145,7 @@ test_decode_csi() {
138145 }'
139146}
140147
141- test_expect_success ' control sequences in sideband allowed by default' '
148+ test_expect_success ' control sequences in sideband allowed by default (in Git v3.8) ' '
142149 write_script .git/color-me-surprised <<-\EOF &&
143150 printf "error: \\033[31mcolor\\033[m\\033[Goverwrite\\033[Gerase\\033[K\\033?25l\\n" >&2
144151 exec "$@"
@@ -147,7 +154,7 @@ test_expect_success 'control sequences in sideband allowed by default' '
147154 test_commit need-at-least-one-commit-at-least &&
148155
149156 rm -rf throw-away &&
150- git clone --no-local . throw-away 2>stderr &&
157+ git -c $TURN_ON_SANITIZING clone --no-local . throw-away 2>stderr &&
151158 test_decode_color <stderr >color-decoded &&
152159 test_decode_csi <color-decoded >decoded &&
153160 test_grep ! "CSI \\[K" decoded &&
@@ -175,14 +182,15 @@ test_expect_success 'allow all control sequences for a specific URL' '
175182 test_commit one-more-please &&
176183
177184 rm -rf throw-away &&
178- git clone --no-local . throw-away 2>stderr &&
185+ git -c $TURN_ON_SANITIZING clone --no-local . throw-away 2>stderr &&
179186 test_decode_color <stderr >color-decoded &&
180187 test_decode_csi <color-decoded >decoded &&
181188 test_grep ! "CSI \\[K" decoded &&
182189 test_grep "\\^\\[\\[K" decoded &&
183190
184191 rm -rf throw-away &&
185- git -c "sideband.file://.allowControlCharacters=true" \
192+ git -c sideband.allowControlCharacters=false \
193+ -c "sideband.file://.allowControlCharacters=true" \
186194 clone --no-local "file://$PWD" throw-away 2>stderr &&
187195 test_decode_color <stderr >color-decoded &&
188196 test_decode_csi <color-decoded >decoded &&
0 commit comments