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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
5fa0f5238b
commit
528d9e6d01
@ -4,7 +4,6 @@ use lib '../../perl/build/lib';
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
use Git;
|
|
||||||
use Cwd qw(realpath);
|
use Cwd qw(realpath);
|
||||||
|
|
||||||
sub get_times {
|
sub get_times {
|
||||||
@ -85,6 +84,11 @@ sub format_size {
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub sane_backticks {
|
||||||
|
open(my $fh, '-|', @_);
|
||||||
|
return <$fh>;
|
||||||
|
}
|
||||||
|
|
||||||
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
|
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
|
||||||
$codespeed, $sortby, $subsection, $reponame);
|
$codespeed, $sortby, $subsection, $reponame);
|
||||||
|
|
||||||
@ -102,7 +106,8 @@ while (scalar @ARGV) {
|
|||||||
my $prefix = '';
|
my $prefix = '';
|
||||||
last if -f $arg or $arg eq "--";
|
last if -f $arg or $arg eq "--";
|
||||||
if (! -d $arg) {
|
if (! -d $arg) {
|
||||||
my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
|
my $rev = sane_backticks(qw(git rev-parse --verify), $arg);
|
||||||
|
chomp $rev;
|
||||||
$dir = "build/".$rev;
|
$dir = "build/".$rev;
|
||||||
} elsif ($arg eq '.') {
|
} elsif ($arg eq '.') {
|
||||||
$dir = '.';
|
$dir = '.';
|
||||||
|
Reference in New Issue
Block a user