{"thread":{"id":"8481","subject":"[PATCH] gitweb: change filename/directory name of snapshots","startedAt":"2007-06-07T09:27:08Z","lastAt":"2007-06-08T17:18:11Z","messageCount":4,"participants":["Matthias Lederhofer","Junio C Hamano","Jakub Narebski","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"44238","messageId":"20070607092708.GA25097@moooo.ath.cx","threadId":"8481","inReplyTo":null,"subject":"[PATCH] gitweb: change filename/directory name of snapshots","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-06-07T09:27:08Z","receivedAt":"2007-06-07T09:27:08Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"/.git or .git is removed from the project name and the\nbasename of the remaining path is used as the beginning of\nthe filename and as the directory in the archive.\n\nThe regexp will actually not strip off /.git or .git if there\nwouldn't be anything left after removing it.\n\nCurrently the full project name is used as directory in the\narchive and the basename is used as filename.  For example a\nrepository named foo/bar/.git will have a archive named\n.git-<version>.* and extract to foo/bar/.git.  With this patch\nthe file is named bar-<version>.* and extracts to bar.\n\nSigned-off-by: Matthias Lederhofer <matled@gmx.net>\n---\nImho the old behaviour does not make much sense but perhaps there are\nusers out there relying on the old behaviour.  OTOH relying on\na web interface not to change is quite bad, especially if you\ncould do the same using the git repository which would be much\nmore reliable.\n---\n\n gitweb/gitweb.perl |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex e92596c..1777393 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4001,8 +4001,10 @@ sub git_snapshot {\n \n \tmy $git = git_cmd_str();\n \tmy $name = $project;\n+\t$name =~ s,([^/])/*\\.git$,$1,;\n+\t$name = basename($name);\n+\tmy $filename = to_utf8($name);\n \t$name =~ s/\\047/\\047\\\\\\047\\047/g;\n-\tmy $filename = to_utf8(basename($project));\n \tmy $cmd;\n \tif ($suffix eq 'zip') {\n \t\t$filename .= \"-$hash.$suffix\";\n-- \n1.5.2.1.888.gd5e4e\n"},{"id":"44324","messageId":"7v4pliltuv.fsf@assigned-by-dhcp.cox.net","threadId":"8481","inReplyTo":"20070607092708.GA25097@moooo.ath.cx","subject":"Re: [PATCH] gitweb: change filename/directory name of snapshots","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-06-08T08:43:04Z","receivedAt":"2007-06-08T08:43:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthias Lederhofer <matled@gmx.net> writes:\n\n> /.git or .git is removed from the project name and the\n> basename of the remaining path is used as the beginning of\n> the filename and as the directory in the archive.\n>\n> The regexp will actually not strip off /.git or .git if there\n> wouldn't be anything left after removing it.\n>\n> Currently the full project name is used as directory in the\n> archive and the basename is used as filename.  For example a\n> repository named foo/bar/.git will have a archive named\n> .git-<version>.* and extract to foo/bar/.git.  With this patch\n> the file is named bar-<version>.* and extracts to bar.\n\nMakes sense to me for \"foo/bar/.git\", but I am not sure if we\nwould want to do this to \"foo/bar.git\".  Opinions?\n"},{"id":"44345","messageId":"f4bf7g$kpe$1@sea.gmane.org","threadId":"8481","inReplyTo":"7v4pliltuv.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: change filename/directory name of snapshots","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-06-08T11:46:00Z","receivedAt":"2007-06-08T11:46:00Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Matthias Lederhofer <matled@gmx.net> writes:\n> \n>> /.git or .git is removed from the project name and the\n>> basename of the remaining path is used as the beginning of\n>> the filename and as the directory in the archive.\n>>\n>> The regexp will actually not strip off /.git or .git if there\n>> wouldn't be anything left after removing it.\n>>\n>> Currently the full project name is used as directory in the\n>> archive and the basename is used as filename.  For example a\n>> repository named foo/bar/.git will have a archive named\n>> .git-<version>.* and extract to foo/bar/.git.  With this patch\n>> the file is named bar-<version>.* and extracts to bar.\n> \n> Makes sense to me for \"foo/bar/.git\", but I am not sure if we\n> would want to do this to \"foo/bar.git\".  Opinions?\n\nI'd like to have snapshot called bar-<sha1>.tar.gz in first case,\nand bar.git-<sha1>.tar.gz (without stripping .git) in the second,\nbut I wouldn't protest too much about having bar-<sha1>.tar.gz\nalso in second case.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"44362","messageId":"20070608171811.GX4489@pasky.or.cz","threadId":"8481","inReplyTo":"7v4pliltuv.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: change filename/directory name of snapshots","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2007-06-08T17:18:11Z","receivedAt":"2007-06-08T17:18:11Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Fri, Jun 08, 2007 at 10:43:04AM CEST, Junio C Hamano wrote:\n> Matthias Lederhofer <matled@gmx.net> writes:\n> \n> > /.git or .git is removed from the project name and the\n> > basename of the remaining path is used as the beginning of\n> > the filename and as the directory in the archive.\n> >\n> > The regexp will actually not strip off /.git or .git if there\n> > wouldn't be anything left after removing it.\n> >\n> > Currently the full project name is used as directory in the\n> > archive and the basename is used as filename.  For example a\n> > repository named foo/bar/.git will have a archive named\n> > .git-<version>.* and extract to foo/bar/.git.  With this patch\n> > the file is named bar-<version>.* and extracts to bar.\n> \n> Makes sense to me for \"foo/bar/.git\", but I am not sure if we\n> would want to do this to \"foo/bar.git\".  Opinions?\n\nI wouldn't personally really mind getting rid of the .git suffix in both\ncases.  Yes, we are used to seeing the \".git\" in the name, but I can't\nthink of any other reasons not to chop it off.\n\nHaving the .git in the archive name might be even more confusing since\nthere is a pseudo-convention (that I'm not sure anyone except me\nfollows, so maybe not :) that repositories have .git in the name while\nworking trees don't, and that tarball contains a working tree.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nEver try. Ever fail. No matter. // Try again. Fail again. Fail better.\n\t\t-- Samuel Beckett\n"}]}