git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] perf/aggregate: add --reponame option

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jan 28, 2018, 19:57 UTC
Message-ID
<CAPig+cR77RTTw3uJAwK3XmmvzE7umv3_7M=NkaDEb=uXyNL4FA@mail.gmail.com>
In-Reply-To
<20180128111843.2690-2-chriscool@tuxfamily.org>

On Sun, Jan 28, 2018 at 6:18 AM, Christian Couder <christian.couder@gmail.com> wrote:

Show 32 quoted lines
> 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.
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
> diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
> @@ -209,15 +218,17 @@ sub print_codespeed_results {
> -       my $environment;
> -       if (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne "") {
> -               $environment = $ENV{GIT_PERF_REPO_NAME};
> -       } elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne "") {
> -               $environment = $ENV{GIT_TEST_INSTALLED};
> -               $environment =~ s|/bin-wrappers$||;
> -       } else {
> -               $environment = `uname -r`;
> -               chomp $environment;
> +       my $environment = $reponame;
> +       if (! $environment) {
> +               if (exists $ENV{GIT_PERF_REPO_NAME} and $ENV{GIT_PERF_REPO_NAME} ne "") {
> +                       $environment = $ENV{GIT_PERF_REPO_NAME};
> +               } elsif (exists $ENV{GIT_TEST_INSTALLED} and $ENV{GIT_TEST_INSTALLED} ne "") {
> +                       $environment = $ENV{GIT_TEST_INSTALLED};
> +                       $environment =~ s|/bin-wrappers$||;
> +               } else {
> +                       $environment = `uname -r`;
> +                       chomp $environment;
> +               }
>         }

Not a big deal, but the extra indentation (and noisy diff) could be avoided like this:

    my $environment;
    if ($reponame) {
        $environment = $reponame;
    } else if (exists ...) {
        ...as before....
    }
Previous: Christian CouderNext: Christian Couder
Message 3 of 6 in “perf/aggregate: add --subsection option”
  1. 1/3 perf/aggregate: add --subsection optionChristian Couder, Jan 28, 2018
  2. 2/3 perf/aggregate: add --reponame optionChristian Couder, Jan 28, 2018
  3. Eric SunshineJan 28, 2018
  4. Christian CouderJan 29, 2018
  5. 3/3 perf/aggregate: sort JSON fields in outputChristian Couder, Jan 28, 2018
  6. Philip OakleyJan 28, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.