Skip to content

Commit fb2c362

Browse files
chriscoolgitster
authored andcommitted
perf/aggregate: add --reponame option
This makes it easier to use the aggregate script on the command line when one wants to get the "environment" fields set in the codespeed output. Previously setting GIT_REPO_NAME was needed for this purpose. Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cd5d4bf commit fb2c362

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

t/perf/aggregate.perl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ sub format_times {
3737
}
3838

3939
my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests,
40-
$codespeed, $subsection);
40+
$codespeed, $subsection, $reponame);
4141
while (scalar @ARGV) {
4242
my $arg = $ARGV[0];
4343
my $dir;
@@ -55,6 +55,15 @@ sub format_times {
5555
}
5656
next;
5757
}
58+
if ($arg eq "--reponame") {
59+
shift @ARGV;
60+
$reponame = $ARGV[0];
61+
shift @ARGV;
62+
if (! $reponame) {
63+
die "empty reponame";
64+
}
65+
next;
66+
}
5867
last if -f $arg or $arg eq "--";
5968
if (! -d $arg) {
6069
my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
@@ -210,7 +219,9 @@ sub print_codespeed_results {
210219
}
211220

212221
my $environment;
213-
if (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne "") {
222+
if ($reponame) {
223+
$environment = $reponame;
224+
} elsif (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne "") {
214225
$environment = $ENV{GIT_PERF_REPO_NAME};
215226
} elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne "") {
216227
$environment = $ENV{GIT_TEST_INSTALLED};

0 commit comments

Comments
 (0)