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
Krzesimir Nowak <krzesimir@endocode.com>
Date
Dec 2, 2013, 10:13 UTC
Message-ID
<1385979199.2054.2.camel@localhost.localdomain>
In-Reply-To
<CAPig+cSjzpSatp9EhpwA9b_XScAPUpkMxmPo70qJCxxakMwq3Q@mail.gmail.com>
On Thu, 2013-11-28 at 20:13 -0500, Eric Sunshine wrote:
Show 30 quoted lines
> On Thu, Nov 28, 2013 at 6:44 AM, Krzesimir Nowak <krzesimir@endocode.com> wrote:
> > 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.

I am cleaning it in case when more sanity checking code gets added. So there is no need to keep the data further.

Show 5 quoted lines
> 
> 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'.)
> 
Gah, ok. I'll fix it. Thanks.
> > +
> >  our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON);
> >  sub evaluate_gitweb_config {
> >         our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
-- 
Krzesimir Nowak
Software Developer
Endocode AG

krzesimir@endocode.com

------
Endocode AG, Johannisstraße 20, 10117 Berlin
info@endocode.com | www.endocode.com

Vorstandsvorsitzender: Mirko Boehm
Vorstände: Dr. Karl Beecher, Chris Kühl, Sebastian Sucker
Aufsichtsratsvorsitzende: Jennifer Beecher

Registergericht: Amtsgericht Charlottenburg - HRB 150748 B
Previous: Eric SunshineNext: Jakub Narębski
Message 3 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.