]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: change filename/directory name of snapshots
authorMatthias Lederhofer <redacted>
Thu, 7 Jun 2007 09:27:08 +0000 (11:27 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
/.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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 2eb281f9df21a904785b974c3de041dc5118a2523546d4e2abda291222c9e618..1d834eed4325a12175878b33cede83d83c24a13d29cb4e5ccce684f866d7a490 100755 (executable)
@@ -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";
This page took 0.269277 seconds and 4 git commands to generate.