Skip to content

Commit c73e7f8

Browse files
jeffhostetlergitster
authored andcommitted
t0211: test URL redacting in PERF format
This transmogrifies the test case that was just added to t0210, to also cover the `GIT_TRACE2_PERF` backend. Just like t0211, we now have to toggle the `TEST_PASSES_SANITIZE_LEAK` annotation. Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b7d49ac commit c73e7f8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

t/t0211-trace2-perf.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
test_description='test trace2 facility (perf target)'
44

5-
TEST_PASSES_SANITIZE_LEAK=true
5+
TEST_PASSES_SANITIZE_LEAK=false
66
. ./test-lib.sh
77

88
# Turn off any inherited trace2 settings for this test.
@@ -268,4 +268,23 @@ test_expect_success PTHREADS 'global counter test/test2' '
268268
have_counter_event "main" "counter" "test" "test2" 60 actual
269269
'
270270

271+
test_expect_success 'unsafe URLs are redacted by default' '
272+
test_when_finished \
273+
"rm -r actual trace.perf unredacted.perf clone clone2" &&
274+
275+
test_config_global \
276+
"url.$(pwd).insteadOf" https://user:[email protected]/ &&
277+
test_config_global trace2.configParams "core.*,remote.*.url" &&
278+
279+
GIT_TRACE2_PERF="$(pwd)/trace.perf" \
280+
git clone https://user:[email protected]/ clone &&
281+
! grep user:pwd trace.perf &&
282+
283+
GIT_TRACE2_REDACT=0 GIT_TRACE2_PERF="$(pwd)/unredacted.perf" \
284+
git clone https://user:[email protected]/ clone2 &&
285+
perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <unredacted.perf >actual &&
286+
grep "d0|main|start|.* clone https://user:[email protected]" actual &&
287+
grep "d0|main|def_param|.*|remote.origin.url:https://user:[email protected]" actual
288+
'
289+
271290
test_done

0 commit comments

Comments
 (0)