From: Junio C Hamano <junkio@cox.net>
To: "Aneesh Kumar K.V" <aneesh.kumar@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: gitweb / cg-export
Date: Wed, 16 Aug 2006 11:01:49 -0700 [thread overview]
Message-ID: <7v4pwc4l0y.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <44E2F911.6060002@gmail.com> (Aneesh Kumar K. V.'s message of "Wed, 16 Aug 2006 16:23:05 +0530")
"Aneesh Kumar K.V" <aneesh.kumar@gmail.com> writes:
> How about the below on top of latest git
>
> -aneesh
This looks Ok (except "$project" needs to be shell quoted on the
pipe-open line and possibly in the URL; there may be some other
minor details I missed). It needs to be protected by elective,
opt-in configuration variable, similarly to how "blame" is done,
since I suspect this would be rather expensive.
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 37a6284..b9b522a 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -175,6 +175,7 @@ my %actions = (
> "tag" => \&git_tag,
> "tags" => \&git_tags,
> "tree" => \&git_tree,
> + "snapshot" => \&git_snapshot,
> );
>
> $action = 'summary' if (!defined($action));
> @@ -1334,6 +1335,7 @@ sub git_shortlog_body {
> "<td class=\"link\">" .
> $cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
> $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") .
> + " | " .$cgi->a({-href => "$my_uri/$project.tar.gz?" . esc_param("p=$project;a=snapshot;h=$commit")}, "snapshot") .
> "</td>\n" .
> "</tr>\n";
> }
> @@ -2097,6 +2099,21 @@ sub git_tree {
> git_footer_html();
> }
>
> +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.");
> + binmode STDOUT, ':raw';
> + print <$fd>;
> + binmode STDOUT, ':utf8'; # as set at the beginning of gitweb.cgi
> + close $fd;
> +
> +
> +}
> +
> sub git_log {
> my $head = git_get_head_hash($project);
> if (!defined $hash) {
next prev parent reply other threads:[~2006-08-16 18:01 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
2006-08-16 18:01 ` Junio C Hamano [this message]
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=7v4pwc4l0y.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--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).