summaryrefslogtreecommitdiff
path: root/t/perf/aggregate.perl
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-10-03 05:14:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-04 21:12:28 (GMT)
commit76f3b69896bf72bb195497d54c7e2f19821a7305 (patch)
tree45f406554653c37a9af403652ccd102cdae82bde /t/perf/aggregate.perl
parent225bc32a989d7a22fa6addafd4ce7dcd04675dbf (diff)
downloadgit-76f3b69896bf72bb195497d54c7e2f19821a7305.zip
git-76f3b69896bf72bb195497d54c7e2f19821a7305.tar.gz
git-76f3b69896bf72bb195497d54c7e2f19821a7305.tar.bz2
t/perf/aggregate.perl: tolerate leading spaces
When using `test_size` with `wc -c`, users on certain platforms can run into issues when `wc` emits leading space characters in its output, which confuses get_times. Callers could switch to use test_file_size instead of `wc -c` (the former never prints leading space characters, so will always work with test_size regardless of platform), but this is an easy enough spot to miss that we should teach get_times to be more tolerant of the input it accepts. Teach get_times to do just that by stripping any leading space characters. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/aggregate.perl')
-rwxr-xr-xt/perf/aggregate.perl4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
index 82c0df4..575d200 100755
--- a/t/perf/aggregate.perl
+++ b/t/perf/aggregate.perl
@@ -17,8 +17,8 @@ sub get_times {
my $rt = ((defined $1 ? $1 : 0.0)*60+$2)*60+$3;
return ($rt, $4, $5);
# size
- } elsif ($line =~ /^\d+$/) {
- return $&;
+ } elsif ($line =~ /^\s*(\d+)$/) {
+ return $1;
} else {
die "bad input line: $line";
}