Skip to content

Commit 9a7d941

Browse files
matledgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aa32eed commit 9a7d941

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitweb/gitweb.perl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4206,8 +4206,10 @@ sub git_snapshot {
42064206

42074207
my $git = git_cmd_str();
42084208
my $name = $project;
4209+
$name =~ s,([^/])/*\.git$,$1,;
4210+
$name = basename($name);
4211+
my $filename = to_utf8($name);
42094212
$name =~ s/\047/\047\\\047\047/g;
4210-
my $filename = to_utf8(basename($project));
42114213
my $cmd;
42124214
if ($suffix eq 'zip') {
42134215
$filename .= "-$hash.$suffix";

0 commit comments

Comments
 (0)