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

Re: [PATCH v3] gitweb: Add an option for adding more branch refs

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Nov 29, 2013, 01:13 UTC
Message-ID
<CAPig+cSjzpSatp9EhpwA9b_XScAPUpkMxmPo70qJCxxakMwq3Q@mail.gmail.com>
In-Reply-To
<1385639092-13362-1-git-send-email-krzesimir@endocode.com>
On Thu, Nov 28, 2013 at 6:44 AM, Krzesimir Nowak <krzesimir@endocode.com> wrote:
Show 26 quoted lines
> Allow @additional_branch_refs configuration variable to tell gitweb to
> show refs from additional hierarchies in addition to branches in the
> list-of-branches view.
>
> Signed-off-by: Krzesimir Nowak <krzesimir@endocode.com>
> ---
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 68c77f6..25e1d37 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -680,6 +688,19 @@ sub read_config_file {
>         return;
>  }
>
> +# performs sanity checks on parts of configuration.
> +sub config_sanity_check {
> +       # check additional refs validity
> +       my %unique_branch_refs = ();
> +       for my $ref (@additional_branch_refs) {
> +               die_error(500, "Invalid ref '$ref' in \@additional_branch_refs") unless (validate_ref($ref));
> +               # 'heads' are added implicitly in get_branch_refs().
> +               $unique_branch_refs{$ref} = 1 if ($ref ne 'heads');
> +       }
> +       @additional_branch_refs = sort keys %unique_branch_refs;
> +       %unique_branch_refs = undef;
> +}

%unique_branch_refs is going out of scope here, so clearing it seems unnecessary.

Moreover, with warnings enabled, perl should be complaining about an "Odd number of elements in hash assignment". (Normally, you would clear a hash with '%foo=()' or 'undef %foo'.)

> +
>  our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
>  sub evaluate_gitweb_config {
>         our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
Previous: Krzesimir NowakNext: Krzesimir Nowak
Message 2 of 12 in “gitweb: Add an option for adding more branch refs”
  1. gitweb: Add an option for adding more branch refsKrzesimir Nowak, Nov 28, 2013
  2. Eric SunshineNov 29, 2013
  3. Krzesimir NowakDec 2, 2013
  4. Jakub NarębskiDec 2, 2013
  5. Krzesimir NowakDec 2, 2013
  6. Jakub NarębskiDec 2, 2013
  7. Krzesimir NowakDec 3, 2013
  8. Jakub NarębskiDec 3, 2013
  9. Krzesimir NowakDec 3, 2013
  10. Junio C HamanoDec 2, 2013
  11. Jakub NarębskiDec 2, 2013
  12. Junio C HamanoDec 2, 2013

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.