From: Matthias Lederhofer Date: Thu, 7 Jun 2007 09:27:08 +0000 (+0200) Subject: gitweb: change filename/directory name of snapshots X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/0f9cc012834c8652352a463efa7df61203a8148da2e5a4f5f3941f2c5ce85bd9 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-.* and extract to foo/bar/.git. With this patch the file is named bar-.* and extracts to bar. Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- diff --git a/gitweb.perl b/gitweb.perl index 2eb281f..1d834ee 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -4207,8 +4207,10 @@ sub git_snapshot { my $git = git_cmd_str(); my $name = $project; + $name =~ s,([^/])/*\.git$,$1,; + $name = basename($name); + my $filename = to_utf8($name); $name =~ s/\047/\047\\\047\047/g; - my $filename = to_utf8(basename($project)); my $cmd; if ($suffix eq 'zip') { $filename .= "-$hash.$suffix";