diff options
author | Matthias Lederhofer <matled@gmx.net> | 2007-06-07 11:27:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-06-12 22:22:06 -0700 |
commit | 9a7d941056fcf6df8324097b73c78353174e4e1b (patch) | |
tree | 1160c9e4a8889cae9817dc2237e673cbb7f63b56 /gitweb | |
parent | Don't dereference a strdup-returned NULL (diff) | |
download | tgif-9a7d941056fcf6df8324097b73c78353174e4e1b.tar.xz |
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>
Diffstat (limited to 'gitweb')
-rwxr-xr-x | gitweb/gitweb.perl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a6383dc85b..dbfb0441a6 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -4206,8 +4206,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"; |