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