@matheusbsbs / matheus-bagliano / commits / 528d9e6d01
Fork 0

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>

Jeff King committed Nov 25, 2019 at 11:47 UTC 528d9e6d0190b0ab8fbbab0b7b1b68f512f5dfcd
1 file changed +7 -2
t/perf/aggregate.perl
+7 -2
@@ -4,7 +4,6 @@ use lib '../../perl/build/lib';
4 use strict;
5 use warnings;
6 use Getopt::Long;
7 -use Git;
7 use Cwd qw(realpath);
8
9 sub get_times {
@@ -85,6 +84,11 @@ sub format_size {
84 return $out;
85 }
86
87 +sub sane_backticks {
88 + open(my $fh, '-|', @_);
89 + return <$fh>;
90 +}
91 +
92 my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
93 $codespeed, $sortby, $subsection, $reponame);
94
@@ -102,7 +106,8 @@ while (scalar @ARGV) {
106 my $prefix = '';
107 last if -f $arg or $arg eq "--";
108 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;
111 $dir = "build/".$rev;
112 } elsif ($arg eq '.') {
113 $dir = '.';