git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Klimov <jim@jimklimov.com>
To: git@vger.kernel.org
Cc: Jim Klimov <jim@jimklimov.com>
Subject: [PATCH 3/6] gitweb.perl : added ability to DEBUG progression through "git archive"
Date: Fri, 11 Mar 2016 14:24:46 +0100	[thread overview]
Message-ID: <1457702689-9084-3-git-send-email-jim@jimklimov.com> (raw)
In-Reply-To: <1457702689-9084-1-git-send-email-jim@jimklimov.com>

---
 gitweb/gitweb.perl | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c715472..fc5b62d 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -891,6 +891,7 @@ sub evaluate_query_params {
 # now read PATH_INFO and update the parameter list for missing parameters
 sub evaluate_path_info {
 	return if defined $input_params{'project'};
+	printf STDERR "path_info='$path_info'\n" if $DEBUG;
 	return if !$path_info;
 	$path_info =~ s,^/+,,;
 	return if !$path_info;
@@ -7336,6 +7337,24 @@ sub git_snapshot {
 	if (!@snapshot_fmts) {
 		die_error(403, "Snapshots not allowed");
 	}
+
+	if ($DEBUG) {
+		my $v; my $i;
+		printf STDERR "path_info='".$path_info."'\n";
+		printf STDERR "input_params: { ";
+		foreach $i (keys (%input_params)) {
+			$v = $input_params{$i};
+			if (defined ($v)) {
+				if ($i eq "extra_options" ) {
+					printf STDERR "  '$i' => [".@{$v}."] ; ";
+				} else {
+				printf STDERR "  '$i' => '$v' ; ";
+				}
+			}
+		}
+		printf STDERR "} \n";
+	}
+
 	# default to first supported snapshot format
 	$format ||= $snapshot_fmts[0];
 	if ($format !~ m/^[a-z0-9]+$/) {
@@ -7367,6 +7386,13 @@ sub git_snapshot {
 	my ($name, $prefix) = snapshot_name($project, $hash);
 	my $filename = "$name$known_snapshot_formats{$format}{'suffix'}";
 
+	if ($DEBUG) {
+		# name of the tarball to generate
+		if (defined $filename)  { printf STDERR "filename='$filename'\n"; }
+		# value of the 'f=' URL parameter
+		if (defined $file_name) { printf STDERR "file_name='$file_name'\n"; }
+	}
+
 	my %co = parse_commit($hash);
 	exit_if_unmodified_since($co{'committer_epoch'}) if %co;
 
@@ -7398,12 +7424,15 @@ sub git_snapshot {
 		%co ? (-last_modified => $latest_date{'rfc2822'}) : (),
 		-status => '200 OK');
 
+	printf STDERR "Starting git-archive: $cmd\n" if $DEBUG;
 	open my $fd, "-|", $cmd
 		or die_error(500, "Execute git-archive failed");
+	printf STDERR "Started git-archive...\n" if $DEBUG;
 	binmode STDOUT, ':raw';
 	print <$fd>;
 	binmode STDOUT, ':utf8'; # as set at the beginning of gitweb.cgi
 	close $fd;
+	printf STDERR "Finished posting output of git-archive...\n" if $DEBUG;
 }
 
 sub git_log_generic {
-- 
2.1.4

  parent reply	other threads:[~2016-03-11 13:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 13:24 [PATCH 1/6] gitweb.perl : added ability to "git archive" just certain paths (files or subdirs, not whole repo) via gitweb interface Jim Klimov
2016-03-11 13:24 ` [PATCH 2/6] gitweb.perl : added ability to debug requests coming through gitweb interface by adding an option to request URL (also requires server-side envvar "GITWEB_MAY_DEBUG=yes") Jim Klimov
2016-03-11 13:24 ` Jim Klimov [this message]
2016-03-11 13:24 ` [PATCH 4/6] gitweb.perl support for snapshots with lists of specified files is now tested Jim Klimov
2016-03-11 13:24 ` [PATCH 5/6] gitweb.perl changed (and tested) to return HTTP-404 when missing objects are requested via snapshot Jim Klimov
2016-03-11 13:24 ` [PATCH 6/6] gitweb.perl : the optional DEBUG functionality is now unit-tested Jim Klimov

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=1457702689-9084-3-git-send-email-jim@jimklimov.com \
    --to=jim@jimklimov.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).