From: Jakub Narebski Date: Thu, 19 Jul 2007 09:14:39 GMT Subject: Re: [PATCH] gitweb: snapshot cleanups & support for offering multiple formats Message-ID: <200707191114.39553.jnareb@gmail.com> In-Reply-To: <1184699486.9831.7.camel@mattlaptop2> On Tue, 17 July 2007, Matt McCutchen wrote: >  sub feature_snapshot { > -       my ($ctype, $suffix, $command) = @_; > +       my (@fmts) = @_; >   >         my ($val) = git_get_project_config('snapshot'); >   > -       if ($val eq 'gzip') { > -               return ('x-gzip', 'gz', 'gzip'); > -       } elsif ($val eq 'bzip2') { > -               return ('x-bzip2', 'bz2', 'bzip2'); > -       } elsif ($val eq 'zip') { > -               return ('x-zip', 'zip', ''); > -       } elsif ($val eq 'none') { > -               return (); > +       if ($val) { > +               @fmts = ($val eq 'none' ? () : split /,/, $val); > +               @fmts = map $known_snapshot_format_aliases{$_} || $_, @fmts; > +               @fmts = grep exists $known_snapshot_formats{$_}, @fmts; >         } >   > -       return ($ctype, $suffix, $command); > -} I would use more permissive (be forbidding in what you accept) regexp to split gitweb.snapshot value into list of snapshot formats, so one could use "tgz, zip", or perhaps even "tgz zip", and not only "tgz,zip" (no whitespace possible). For example + @fmts = ($val eq 'none' ? () : split(/\s*,\s*/, $val)); or even + @fmts = ($val eq 'none' ? () : split(/\s*[,\s]\s*/, $val)); to allow "tgz zip". Your regexp for "tgz, zip" would get 'tgz', ' zip' (with leading space) as snapshot formats to use. -- Jakub Narebski Poland