git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fredrik Kuivinen <freku045@student.liu.se>
To: "Aneesh Kumar K.V" <aneesh.kumar@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: gitweb / cg-export
Date: Wed, 16 Aug 2006 22:05:57 +0200	[thread overview]
Message-ID: <20060816200557.GB9575@c165.ib.student.liu.se> (raw)
In-Reply-To: <ebuvok$vnv$1@sea.gmane.org>

On Wed, Aug 16, 2006 at 05:02:36PM +0530, Aneesh Kumar K.V wrote:
> Aneesh Kumar K.V wrote:
> >Jakub Narebski wrote:
> >>Toby White wrote:
> >>
> >>>I was wondering if a feature like the following would be of
> >>>use to anyone except me: I'd like to be able to download
> >>>the full source of a given tree from gitweb.
> >>[...]
> >>So you want to have snapshot of a tree. Why not snapshot of a commit, 
> >>or of a tag?
> >>
> >>>I've quickly hacked gitweb to do this for me - patch below.
> >>>
> >>>It adds an extra link to the 'commit' page. Next to the link
> >>>that would lead you to 'tree', there is 'tar.gz' which simply
> >>>returns the tar.gz of the same tree.
> >>>
> >>>The patch is against the version of gitweb currently in
> >>>Debian, which is, erm, '264-1', apparently, because that's
> >>>what I had to hand.
> >>
> >>It is really better to hack git with git. And you can use current gitweb
> >>with old git (well, not always, as current gitweb requires --full-history
> >>option to git-rev-list to be available).
> >>
> >
> >How about the below on top of latest git
> 
> Add it to git_commit too. The patch contains the pervious changes also.
> 

Nice.

> +sub git_snapshot {
> +	if (!defined $hash) {
> +		$hash = git_get_head_hash($project);
> +	}
> +	print $cgi->header(-type=>'application/x-tar',
> +			  -Content-Encoding=>'x-gzip', -status=> '200 OK');
> +	open my $fd, "-|", "$GIT tar-tree $hash $project | gzip -c9" or die_error(undef, "Execute git-tar-tree failed.");

It might be better to use -6 (the default compression/speed trade-off)
instead of using -9 (best but slowest compression) here.  Or maybe
even make it configurable. On some servers it is probably preferable
to make the snapshot (slightly) larger and gain some cpu time.

To get some numbers I made a small benchmark with the current git
tree. I get the following on my machine:

Compression/speed    Size   Time
-1                   1.1M   0.16s
-6                   923K   0.36s
-9                   917K   0.50s  

- Fredrik

  reply	other threads:[~2006-08-16 20:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-16  0:16 gitweb / cg-export Toby White
2006-08-16  0:23 ` gitweb / cg-export - corrected patch Toby White
2006-08-16  9:54 ` gitweb / cg-export Jakub Narebski
2006-08-16 10:53   ` Aneesh Kumar K.V
2006-08-16 11:32     ` Aneesh Kumar K.V
2006-08-16 20:05       ` Fredrik Kuivinen [this message]
2006-08-16 18:01     ` Junio C Hamano
2006-08-17  6:29       ` gitweb: Support for snapshots in gitweb Aneesh Kumar K.V
2006-08-17  7:34         ` Junio C Hamano
2006-08-17  7:48           ` Aneesh Kumar
2006-08-17  9:49         ` Jakub Narebski
2006-08-16 22:40     ` gitweb / cg-export Martin Waitz
2006-08-16 22:50       ` Kay Sievers

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=20060816200557.GB9575@c165.ib.student.liu.se \
    --to=freku045@student.liu.se \
    --cc=aneesh.kumar@gmail.com \
    --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).