git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/6] gitweb.perl : added ability to DEBUG progression through "git archive"

From
JKJim Klimov <jim@jimklimov.com>
Date
Mar 11, 2016, 13:24 UTC
Message-ID
<1457702689-9084-3-git-send-email-jim@jimklimov.com>
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
Previous: Jim KlimovNext: Jim Klimov
Message 3 of 6 in “gitweb.perl : added ability to "git archive" just certain paths (files or subdirs, not whole repo) via gitweb interface”
  1. 1/6 gitweb.perl : added ability to "git archive" just certain paths (files or subdirs, not whole repo) via gitweb interfaceJim Klimov, Mar 11, 2016
  2. 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, Mar 11, 2016
  3. 3/6 gitweb.perl : added ability to DEBUG progression through "git archive"Jim Klimov, Mar 11, 2016
  4. 4/6 gitweb.perl support for snapshots with lists of specified files is now testedJim Klimov, Mar 11, 2016
  5. 5/6 gitweb.perl changed (and tested) to return HTTP-404 when missing objects are requested via snapshotJim Klimov, Mar 11, 2016
  6. 6/6 gitweb.perl : the optional DEBUG functionality is now unit-testedJim Klimov, Mar 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.