gitweb: change filename/directory name of snapshots
/.git or .git is removed from the project name and the basename of the remaining path is used as the beginning of the filename and as the directory in the archive. The regexp will actually not strip off /.git or .git if there wouldn't be anything left after removing it. Currently the full project name is used as directory in the archive and the basename is used as filename. For example a repository named foo/bar/.git will have a archive named .git-<version>.* and extract to foo/bar/.git. With this patch the file is named bar-<version>.* and extracts to bar. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthias Lederhofer committed
Jun 7, 2007 at 11:27 UTC
9a7d941056fcf6df8324097b73c78353174e4e1b
1 file changed
+3
-1
gitweb/gitweb.perl
+3
-1
@@ -4206,8 +4206,10 @@ sub git_snapshot {
4206
4207
my $git = git_cmd_str();
4208
my $name = $project;
4209
+ $name =~ s,([^/])/*\.git$,$1,;
4210
+ $name = basename($name);
4211
+ my $filename = to_utf8($name);
4212
$name =~ s/\047/\047\\\047\047/g;
4210
- my $filename = to_utf8(basename($project));
4213
my $cmd;
4214
if ($suffix eq 'zip') {
4215
$filename .= "-$hash.$suffix";