Skip to content

Commit 528d9e6

Browse files
peffgitster
authored andcommitted
t/perf: don't depend on Git.pm
The perf suite's aggregate.perl depends on Git.pm, which is a mild annoyance if you've built git with NO_PERL. It turns out that the only thing we use it for is a single call of the command_oneline() helper. We can just replace this with backticks or similar. Annoyingly, perl has no backtick equivalent that avoids a shell eval, which means our $arg would require quoting. This probably doesn't matter for our purposes, but it's better to be safe and model good style. So we'll just provide a short helper around open(), which takes its arguments as a list. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5fa0f52 commit 528d9e6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

t/perf/aggregate.perl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use strict;
55
use warnings;
66
use Getopt::Long;
7-
use Git;
87
use Cwd qw(realpath);
98

109
sub get_times {
@@ -85,6 +84,11 @@ sub format_size {
8584
return $out;
8685
}
8786

87+
sub sane_backticks {
88+
open(my $fh, '-|', @_);
89+
return <$fh>;
90+
}
91+
8892
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
8993
$codespeed, $sortby, $subsection, $reponame);
9094

@@ -102,7 +106,8 @@ sub format_size {
102106
my $prefix = '';
103107
last if -f $arg or $arg eq "--";
104108
if (! -d $arg) {
105-
my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
109+
my $rev = sane_backticks(qw(git rev-parse --verify), $arg);
110+
chomp $rev;
106111
$dir = "build/".$rev;
107112
} elsif ($arg eq '.') {
108113
$dir = '.';

0 commit comments

Comments
 (0)