Re: [PATCH] gitweb: snapshot cleanups & support for offering multiple formats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux