Skip to content

Commit

Permalink
t0211: test URL redacting in PERF format
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
  • Loading branch information
jeffhostetler authored and dscho committed Nov 14, 2023
1 parent 510418c commit 21b2850
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions t/t0211-trace2-perf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,23 @@ test_expect_success PTHREADS 'global counter test/test2' '
have_counter_event "main" "counter" "test" "test2" 60 actual
'

test_expect_success 'unsafe URLs are redacted by default' '
test_when_finished \
"rm -r actual trace.perf unredacted.perf clone clone2" &&
test_config_global \
"url.$(pwd).insteadOf" https://user:pwd@example.com/ &&
test_config_global trace2.configParams "core.*,remote.*.url" &&
GIT_TRACE2_PERF="$(pwd)/trace.perf" \
git clone https://user:pwd@example.com/ clone &&
! grep user:pwd trace.perf &&
GIT_TRACE2_REDACT=0 GIT_TRACE2_PERF="$(pwd)/unredacted.perf" \
git clone https://user:pwd@example.com/ clone2 &&
perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <unredacted.perf >actual &&
grep "d0|main|start|.* clone https://user:pwd@example.com" actual &&
grep "d0|main|def_param|.*|remote.origin.url:https://user:pwd@example.com" actual
'

test_done

0 comments on commit 21b2850

Please sign in to comment.