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

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

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 19, 2007, 09:14 UTC
Message-ID
<200707191114.39553.jnareb@gmail.com>
In-Reply-To
<1184699486.9831.7.camel@mattlaptop2>
On Tue, 17 July 2007, Matt McCutchen wrote:
Show 22 quoted lines
>  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
Previous: Junio C HamanoNext: Jakub Narebski
Message 22 of 35 in “gitweb: snapshot cleanups & support for offering multiple formats”
  1. gitweb: snapshot cleanups & support for offering multiple formatsMatt McCutchen, Jun 28, 2007
  2. Junio C HamanoJul 7, 2007
  3. Junio C HamanoJul 8, 2007
  4. Jakub NarebskiJul 11, 2007
  5. Junio C HamanoJul 11, 2007
  6. Matt McCutchenJul 12, 2007
  7. Jakub NarebskiJul 12, 2007
  8. Matt McCutchenJul 17, 2007
  9. gitweb: snapshot cleanups & support for offering multiple formatsMatt McCutchen, Jul 17, 2007
  10. Jakub NarebskiJul 18, 2007
  11. Junio C HamanoJul 19, 2007
  12. Luben TuikovJul 19, 2007
  13. Jakub NarebskiJul 19, 2007
  14. Luben TuikovJul 19, 2007
  15. gitweb: Enable transparent compression form HTTP outputJakub Narebski, Jul 25, 2007
  16. Petr BaudisAug 25, 2007
  17. Jakub NarebskiAug 25, 2007
  18. Petr BaudisAug 25, 2007
  19. Jakub NarebskiAug 27, 2007
  20. Jakub NarebskiJul 19, 2007
  21. Junio C HamanoJul 20, 2007
  22. Jakub NarebskiJul 19, 2007
  23. gitweb: snapshot cleanups & support for offering multiple formatsJakub Narebski, Jul 21, 2007
  24. Junio C HamanoJul 22, 2007
  25. Matt McCutchenJul 22, 2007
  26. gitweb: Fix support for legacy gitweb config for snapshotsJakub Narebski, Jul 22, 2007
  27. Matt McCutchenJul 22, 2007
  28. Junio C HamanoJul 22, 2007
  29. Junio C HamanoJul 8, 2007
  30. Matt McCutchenJul 9, 2007
  31. gitweb: snapshot cleanups & support for offering multiple formatsMatt McCutchen, Jul 9, 2007
  32. Jakub NarebskiJul 10, 2007
  33. Junio C HamanoJul 9, 2007
  34. gitweb: snapshot cleanups & support for offering multiple formatsMatt McCutchen, Jul 10, 2007
  35. gitweb: snapshot cleanups & support for offering multiple formatsMatt McCutchen, Jul 10, 2007

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.