---
gitweb/gitweb.perl | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 05d7910..030d429 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -7328,6 +7328,15 @@ sub git_snapshot {
die_error(403, "Unsupported snapshot format");
}
+ if (!defined($hash)) {
+ $hash="";
+ if ( $file_name && $file_name =~ /^([^:]*):(.*)$/ ) {
+ $hash = "$1";
+ $file_name = "$2";
+ }
+ if ( $hash eq "") { $hash = "HEAD"; }
+ printf STDERR "Defaulted hash to '$hash' ('h=' URL argument was
missing)\n";
+ }
my $type = git_get_type("$hash^{}");
if (!$type) {
die_error(404, 'Object does not exist');
@@ -7345,6 +7354,14 @@ sub git_snapshot {
git_cmd(), 'archive',
"--format=$known_snapshot_formats{$format}{'format'}",
"--prefix=$prefix/", $hash);
+ if ($file_name) {
+ # To fetch several pathnames use space-separation, e.g.
+ # "...git-web?p=proj.git;a=snapshot;f=file1%20file2
+ # To fetch pathnames with spaces, escape them, e.g.
+ # "...git-web?p=proj.git;a=snapshot;f=file\%20name
+ $cmd .= " " . $file_name;
+ }
+
if (exists $known_snapshot_formats{$format}{'compressor'}) {
$cmd .= ' | ' .
quote_command(@{$known_snapshot_formats{$format}{'compressor'}});
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html