git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Lederhofer <matled@gmx.net>
To: git@vger.kernel.org
Subject: [PATCH] gitweb: change filename/directory name of snapshots
Date: Thu, 7 Jun 2007 11:27:08 +0200	[thread overview]
Message-ID: <20070607092708.GA25097@moooo.ath.cx> (raw)

/.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>
---
Imho the old behaviour does not make much sense but perhaps there are
users out there relying on the old behaviour.  OTOH relying on
a web interface not to change is quite bad, especially if you
could do the same using the git repository which would be much
more reliable.
---

 gitweb/gitweb.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e92596c..1777393 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4001,8 +4001,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";
-- 
1.5.2.1.888.gd5e4e

             reply	other threads:[~2007-06-07  9:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07  9:27 Matthias Lederhofer [this message]
2007-06-08  8:43 ` [PATCH] gitweb: change filename/directory name of snapshots Junio C Hamano
2007-06-08 11:46   ` Jakub Narebski
2007-06-08 17:18   ` Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070607092708.GA25097@moooo.ath.cx \
    --to=matled@gmx.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).