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>

Taylor Blau committed Oct 3, 2021 at 01:14 UTC 76f3b69896bf72bb195497d54c7e2f19821a7305
1 file changed +2 -2
t/perf/aggregate.perl
+2 -2
@@ -17,8 +17,8 @@ sub get_times {
17 my $rt = ((defined $1 ? $1 : 0.0)*60+$2)*60+$3;
18 return ($rt, $4, $5);
19 # size
20 - } elsif ($line =~ /^\d+$/) {
21 - return $&;
20 + } elsif ($line =~ /^\s*(\d+)$/) {
21 + return $1;
22 } else {
23 die "bad input line: $line";
24 }