From: Petr Baudis Date: Tue, 22 May 2007 12:28:28 GMT Subject: Re: [PATCH] gitweb.perl - Optionally send archives as .zip files Message-ID: <20070522122828.GJ4489@pasky.or.cz> In-Reply-To: <11796760064103-git-send-email-mdl123@verizon.net> Hi, On Sun, May 20, 2007 at 05:46:46PM CEST, Mark Levedahl wrote: > git-archive already knows how to generate an archive as a tar or a zip > file, but gitweb did not. zip archvies are much more usable in a Windows > environment due to native support and this patch allows a site admin the > option to deliver zip rather than tar files. The selection is done by > inserting > > $feature{'snapshot'}{'default'} = ['x-zip', 'zip', '']; > > in gitweb_config.perl. > > Tar files remain the default option. > > Signed-off-by: Mark Levedahl Acked-by: Petr Baudis Maybe the code should decide based on program value being 'zip' rather than suffix value, but that's just dubious nit-picking. > @@ -3912,19 +3914,26 @@ sub git_snapshot { > $hash = git_get_head_hash($project); > } > > - my $filename = decode_utf8(basename($project)) . "-$hash.tar.$suffix"; > + my $git = git_cmd_str(); > + my $name = $project; > + $name =~ s/\047/\047\\\047\047/g; By the way, this really looks like an entry to our very own would-be "git obfuscation of the month" contest. Why did whoever made the code not just write that ' there? (I know it's been in the original code too.) -- Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ Ever try. Ever fail. No matter. // Try again. Fail again. Fail better. -- Samuel Beckett