aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqorg11 <qorg@vxempire.xyz>2020-10-17 01:18:50 +0200
committerqorg11 <qorg@vxempire.xyz>2020-10-17 01:18:50 +0200
commit6b12dc42419647af6e04df1a886a8590ba2fcc9f (patch)
tree396fd3e0f93e84b0c72869ac5d93db830f5fe4dd
parentb7fe547d3e3676691d14b2d638825323410a381e (diff)
downloadgitweb-6b12dc42419647af6e04df1a886a8590ba2fcc9f.tar.gz
gitweb-6b12dc42419647af6e04df1a886a8590ba2fcc9f.tar.bz2
gitweb-6b12dc42419647af6e04df1a886a8590ba2fcc9f.zip
- Added new compression algorithms for you dudes to download (zip, lzip, xz...)
- Removed the owner row since it's pretty obvious who the owner is (qorg11 :D)
-rwxr-xr-xgitweb.cgi221
1 files changed, 85 insertions, 136 deletions
diff --git a/gitweb.cgi b/gitweb.cgi
index 600ea89..c73cc17 100755
--- a/gitweb.cgi
+++ b/gitweb.cgi
@@ -35,7 +35,7 @@ BEGIN {
CGI->compile() if $ENV{'MOD_PERL'};
}
-our $version = "2.25.1";
+our $version = "2.20.1";
our ($my_url, $my_uri, $base_url, $path_info, $home_link);
sub evaluate_uri {
@@ -119,7 +119,6 @@ our $logo = "static/git-logo.png";
# URI of GIT favicon, assumed to be image/png type
our $favicon = "static/git-favicon.png";
# URI of gitweb.js (JavaScript code for gitweb)
-our $javascript = "static/gitweb.js";
# URI and label (title) of GIT logo link
#our $logo_url = "http://www.kernel.org/pub/software/scm/git/docs/";
@@ -232,14 +231,26 @@ our %known_snapshot_formats = (
'type' => 'application/x-xz',
'suffix' => '.tar.xz',
'format' => 'tar',
- 'compressor' => ['xz'],
- 'disabled' => 1},
-
+ 'compressor' => ['xz']
+ },
+ 'tar' => {
+ 'display' => '.tar',
+ 'type' => 'application/tar',
+ 'suffix' => '.tar',
+ 'format' => 'tar',
+ },
'zip' => {
'display' => 'zip',
'type' => 'application/x-zip',
'suffix' => '.zip',
- 'format' => 'zip'},
+ 'format' => 'zip'},
+ 'lzip' => {
+ 'display' => 'lzip',
+ 'type' => 'application/lzip',
+ 'suffix' => '.tar.lz',
+ 'format' => 'tar',
+ 'compressor' => ['lzip']
+ }
);
# Aliases so we understand old gitweb.snapshot values in repository
@@ -248,7 +259,7 @@ our %known_snapshot_format_aliases = (
'gzip' => 'tgz',
'bzip2' => 'tbz2',
'xz' => 'txz',
-
+ 'lz' => 'lz',
# backward compatibility: legacy gitweb config support
'x-gzip' => undef, 'gz' => undef,
'x-bzip2' => undef, 'bz2' => undef,
@@ -741,7 +752,7 @@ sub evaluate_gitweb_config {
$GITWEB_CONFIG_SYSTEM = "" if ($GITWEB_CONFIG_SYSTEM eq $GITWEB_CONFIG_COMMON);
# Common system-wide settings for convenience.
- # Those settings can be overridden by GITWEB_CONFIG or GITWEB_CONFIG_SYSTEM.
+ # Those settings can be ovverriden by GITWEB_CONFIG or GITWEB_CONFIG_SYSTEM.
read_config_file($GITWEB_CONFIG_COMMON);
# Use first config file that exists. This means use the per-instance
@@ -788,38 +799,6 @@ sub check_loadavg {
# ======================================================================
# input validation and dispatch
-# Various hash size-related values.
-my $sha1_len = 40;
-my $sha256_extra_len = 24;
-my $sha256_len = $sha1_len + $sha256_extra_len;
-
-# A regex matching $len hex characters. $len may be a range (e.g. 7,64).
-sub oid_nlen_regex {
- my $len = shift;
- my $hchr = qr/[0-9a-fA-F]/;
- return qr/(?:(?:$hchr){$len})/;
-}
-
-# A regex matching two sets of $nlen hex characters, prefixed by the literal
-# string $prefix and with the literal string $infix between them.
-sub oid_nlen_prefix_infix_regex {
- my $nlen = shift;
- my $prefix = shift;
- my $infix = shift;
-
- my $rx = oid_nlen_regex($nlen);
-
- return qr/^\Q$prefix\E$rx\Q$infix\E$rx$/;
-}
-
-# A regex matching a valid object ID.
-our $oid_regex;
-{
- my $x = oid_nlen_regex($sha1_len);
- my $y = oid_nlen_regex($sha256_extra_len);
- $oid_regex = qr/(?:$x(?:$y)?)/;
-}
-
# input parameters can be collected from a variety of sources (presently, CGI
# and PATH_INFO), so we define an %input_params hash that collects them all
# together during validation: this allows subsequent uses (e.g. href()) to be
@@ -1548,7 +1527,7 @@ sub is_valid_refname {
return undef unless defined $input;
# textual hashes are O.K.
- if ($input =~ m/^$oid_regex$/) {
+ if ($input =~ m/^[0-9a-fA-F]{40}$/) {
return 1;
}
# it must be correct pathname
@@ -1657,15 +1636,15 @@ sub quot_cec {
my $cntrl = shift;
my %opts = @_;
my %es = ( # character escape codes, aka escape sequences
- "\t" => '\t', # tab (HT)
- "\n" => '\n', # line feed (LF)
- "\r" => '\r', # carriage return (CR)
- "\f" => '\f', # form feed (FF)
- "\b" => '\b', # backspace (BS)
- "\a" => '\a', # alarm (bell) (BEL)
- "\e" => '\e', # escape (ESC)
- "\013" => '\v', # vertical tab (VT)
- "\000" => '\0', # nul character (NUL)
+ "\t" => '\t', # tab (HT)
+ "\n" => '\n', # line feed (LF)
+ "\r" => '\r', # carrige return (CR)
+ "\f" => '\f', # form feed (FF)
+ "\b" => '\b', # backspace (BS)
+ "\a" => '\a', # alarm (bell) (BEL)
+ "\e" => '\e', # escape (ESC)
+ "\013" => '\v', # vertical tab (VT)
+ "\000" => '\0', # nul character (NUL)
);
my $chr = ( (exists $es{$cntrl})
? $es{$cntrl}
@@ -2060,9 +2039,6 @@ sub file_type_long {
sub format_log_line_html {
my $line = shift;
- # Potentially abbreviated OID.
- my $regex = oid_nlen_regex("7,64");
-
$line = esc_html($line, -nbsp=>1);
$line =~ s{
\b
@@ -2072,10 +2048,10 @@ sub format_log_line_html {
(?<!-) # see strbuf_check_tag_ref(). Tags can't start with -
[A-Za-z0-9.-]+
(?!\.) # refs can't end with ".", see check_refname_format()
- -g$regex
+ -g[0-9a-fA-F]{7,40}
|
# Just a normal looking Git SHA1
- $regex
+ [0-9a-fA-F]{7,40}
)
\b
}{
@@ -2321,8 +2297,7 @@ sub format_extended_diff_header_line {
')</span>';
}
# match <hash>
- if ($line =~ oid_nlen_prefix_infix_regex($sha1_len, "index ", ",") |
- $line =~ oid_nlen_prefix_infix_regex($sha256_len, "index ", ",")) {
+ if ($line =~ m/^index [0-9a-fA-F]{40},[0-9a-fA-F]{40}/) {
# can match only for combined diff
$line = 'index ';
for (my $i = 0; $i < $diffinfo->{'nparents'}; $i++) {
@@ -2344,8 +2319,7 @@ sub format_extended_diff_header_line {
$line .= '0' x 7;
}
- } elsif ($line =~ oid_nlen_prefix_infix_regex($sha1_len, "index ", "..") |
- $line =~ oid_nlen_prefix_infix_regex($sha256_len, "index ", "..")) {
+ } elsif ($line =~ m/^index [0-9a-fA-F]{40}..[0-9a-fA-F]{40}/) {
# can match only for ordinary diff
my ($from_link, $to_link);
if ($from->{'href'}) {
@@ -2871,7 +2845,7 @@ sub git_get_hash_by_path {
}
#'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
- $line =~ m/^([0-9]+) (.+) ($oid_regex)\t/;
+ $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t/;
if (defined $type && $type ne $2) {
# type doesn't match
return undef;
@@ -3370,7 +3344,7 @@ sub git_get_references {
while (my $line = <$fd>) {
chomp $line;
- if ($line =~ m!^($oid_regex)\srefs/($type.*)$!) {
+ if ($line =~ m!^([0-9a-fA-F]{40})\srefs/($type.*)$!) {
if (defined $refs{$1}) {
push @{$refs{$1}}, $2;
} else {
@@ -3444,7 +3418,7 @@ sub parse_tag {
$tag{'id'} = $tag_id;
while (my $line = <$fd>) {
chomp $line;
- if ($line =~ m/^object ($oid_regex)$/) {
+ if ($line =~ m/^object ([0-9a-fA-F]{40})$/) {
$tag{'object'} = $1;
} elsif ($line =~ m/^type (.+)$/) {
$tag{'type'} = $1;
@@ -3488,15 +3462,15 @@ sub parse_commit_text {
}
my $header = shift @commit_lines;
- if ($header !~ m/^$oid_regex/) {
+ if ($header !~ m/^[0-9a-fA-F]{40}/) {
return;
}
($co{'id'}, my @parents) = split ' ', $header;
while (my $line = shift @commit_lines) {
last if $line eq "\n";
- if ($line =~ m/^tree ($oid_regex)$/) {
+ if ($line =~ m/^tree ([0-9a-fA-F]{40})$/) {
$co{'tree'} = $1;
- } elsif ((!defined $withparents) && ($line =~ m/^parent ($oid_regex)$/)) {
+ } elsif ((!defined $withparents) && ($line =~ m/^parent ([0-9a-fA-F]{40})$/)) {
push @parents, $1;
} elsif ($line =~ m/^author (.*) ([0-9]+) (.*)$/) {
$co{'author'} = to_utf8($1);
@@ -3628,7 +3602,7 @@ sub parse_difftree_raw_line {
# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M ls-files.c'
# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M rev-tree.c'
- if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ($oid_regex) ($oid_regex) (.)([0-9]{0,3})\t(.*)$/) {
+ if ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/) {
$res{'from_mode'} = $1;
$res{'to_mode'} = $2;
$res{'from_id'} = $3;
@@ -3643,7 +3617,7 @@ sub parse_difftree_raw_line {
}
# '::100755 100755 100755 60e79ca1b01bc8b057abe17ddab484699a7f5fdb 94067cc5f73388f33722d52ae02f44692bc07490 94067cc5f73388f33722d52ae02f44692bc07490 MR git-gui/git-gui.sh'
# combined diff (for merge commit)
- elsif ($line =~ s/^(::+)((?:[0-7]{6} )+)((?:$oid_regex )+)([a-zA-Z]+)\t(.*)$//) {
+ elsif ($line =~ s/^(::+)((?:[0-7]{6} )+)((?:[0-9a-fA-F]{40} )+)([a-zA-Z]+)\t(.*)$//) {
$res{'nparents'} = length($1);
$res{'from_mode'} = [ split(' ', $2) ];
$res{'to_mode'} = pop @{$res{'from_mode'}};
@@ -3653,7 +3627,7 @@ sub parse_difftree_raw_line {
$res{'to_file'} = unquote($5);
}
# 'c512b523472485aef4fff9e57b229d9d243c967f'
- elsif ($line =~ m/^($oid_regex)$/) {
+ elsif ($line =~ m/^([0-9a-fA-F]{40})$/) {
$res{'commit'} = $1;
}
@@ -3681,7 +3655,7 @@ sub parse_ls_tree_line {
if ($opts{'-l'}) {
#'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa 16717 panic.c'
- $line =~ m/^([0-9]+) (.+) ($oid_regex) +(-|[0-9]+)\t(.+)$/s;
+ $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40}) +(-|[0-9]+)\t(.+)$/s;
$res{'mode'} = $1;
$res{'type'} = $2;
@@ -3694,7 +3668,7 @@ sub parse_ls_tree_line {
}
} else {
#'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
- $line =~ m/^([0-9]+) (.+) ($oid_regex)\t(.+)$/s;
+ $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/s;
$res{'mode'} = $1;
$res{'type'} = $2;
@@ -4048,7 +4022,7 @@ sub print_feed_meta {
$href_params{'extra_options'} = undef;
$href_params{'action'} = $type;
- $link_attr{'-href'} = esc_attr(href(%href_params));
+ $link_attr{'-href'} = href(%href_params);
print "<link ".
"rel=\"$link_attr{'-rel'}\" ".
"title=\"$link_attr{'-title'}\" ".
@@ -4057,7 +4031,7 @@ sub print_feed_meta {
"/>\n";
$href_params{'extra_options'} = '--no-merges';
- $link_attr{'-href'} = esc_attr(href(%href_params));
+ $link_attr{'-href'} = href(%href_params);
$link_attr{'-title'} .= ' (no merges)';
print "<link ".
"rel=\"$link_attr{'-rel'}\" ".
@@ -4070,12 +4044,10 @@ sub print_feed_meta {
} else {
printf('<link rel="alternate" title="%s projects list" '.
'href="%s" type="text/plain; charset=utf-8" />'."\n",
- esc_attr($site_name),
- esc_attr(href(project=>undef, action=>"project_index")));
+ esc_attr($site_name), href(project=>undef, action=>"project_index"));
printf('<link rel="alternate" title="%s projects feeds" '.
'href="%s" type="text/x-opml" />'."\n",
- esc_attr($site_name),
- esc_attr(href(project=>undef, action=>"opml")));
+ esc_attr($site_name), href(project=>undef, action=>"opml"));
}
}
@@ -4223,13 +4195,7 @@ EOF
$cgi->img({-src => esc_url($logo),
-width => 72, -height => 27,
-alt => "git",
- -class => "logo"}));
- print $cgi->a({-href => esc_url("https://qorg11.net/img/qorg11px.gif"),
- -title => $logo_label},
- $cgi->img({-src => esc_url("https://qorg11.net/img/qorg11px.gif"),
- -width=> 72, -height => 27,
- -alt => "qorg11",
- -class => "logo"}));
+ -class => "logo"}));
}
print_nav_breadcrumbs(%opts);
print "</div>\n";
@@ -4291,12 +4257,11 @@ sub git_footer_html {
insert_file($site_footer);
}
- print qq!<script type="text/javascript" src="!.esc_url($javascript).qq!"></script>\n!;
if (defined $action &&
$action eq 'blame_incremental') {
print qq!<script type="text/javascript">\n!.
- qq!startBlame("!. esc_attr(href(action=>"blame_data", -replay=>1)) .qq!",\n!.
- qq! "!. esc_attr(href()) .qq!");\n!.
+ qq!startBlame("!. href(action=>"blame_data", -replay=>1) .qq!",\n!.
+ qq! "!. href() .qq!");\n!.
qq!</script>\n!;
} else {
my ($jstimezone, $tz_cookie, $datetime_class) =
@@ -4844,7 +4809,7 @@ sub fill_from_file_info {
sub is_deleted {
my $diffinfo = shift;
- return $diffinfo->{'to_id'} eq ('0' x 40) || $diffinfo->{'to_id'} eq ('0' x 64);
+ return $diffinfo->{'to_id'} eq ('0' x 40);
}
# does patch correspond to [previous] difftree raw line
@@ -5291,7 +5256,7 @@ sub format_ctx_rem_add_lines {
# + c
# + d
#
- # Otherwise the highlighting would be confusing.
+ # Otherwise the highlightling would be confusing.
if ($is_combined) {
for (my $i = 0; $i < @$add; $i++) {
my $prefix_rem = substr($rem->[$i], 0, $num_parents);
@@ -5776,9 +5741,6 @@ sub git_project_list_rows {
$pr->{'descr'}, $search_regexp)
: esc_html($pr->{'descr'})) .
"</td>\n";
- unless ($omit_owner) {
- print "<td><i>" . chop_and_escape_str($pr->{'owner'}, 15) . "</i></td>\n";
- }
unless ($omit_age_column) {
print "<td class=\"". age_class($pr->{'age'}) . "\">" .
(defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n";
@@ -5848,7 +5810,6 @@ sub git_project_list_body {
}
print_sort_th('project', $order, 'Project');
print_sort_th('descr', $order, 'Description');
- print_sort_th('owner', $order, 'Owner') unless $omit_owner;
print_sort_th('age', $order, 'Last Change') unless $omit_age_column;
print "<th></th>\n" . # for links
"</tr>\n";
@@ -6330,7 +6291,7 @@ sub git_search_changes {
-class => "list subject"},
chop_and_escape_str($co{'title'}, 50) . "<br/>");
} elsif (defined $set{'to_id'}) {
- next if is_deleted(\%set);
+ next if ($set{'to_id'} =~ m/^0{40}$/);
print $cgi->a({-href => href(action=>"blob", hash_base=>$co{'id'},
hash=>$set{'to_id'}, file_name=>$set{'to_file'}),
@@ -6504,7 +6465,7 @@ sub git_search_grep_body {
sub git_project_list {
my $order = $input_params{'order'};
- if (defined $order && $order !~ m/none|project|descr|owner|age/) {
+ if (defined $order && $order !~ m/none|project|descr|age/) {
die_error(400, "Unknown order parameter");
}
@@ -6527,7 +6488,7 @@ sub git_project_list {
sub git_forks {
my $order = $input_params{'order'};
- if (defined $order && $order !~ m/none|project|descr|owner|age/) {
+ if (defined $order && $order !~ m/none|project|descr|age/) {
die_error(400, "Unknown order parameter");
}
@@ -6557,18 +6518,11 @@ sub git_project_index {
-content_disposition => 'inline; filename="index.aux"');
foreach my $pr (@projects) {
- if (!exists $pr->{'owner'}) {
- $pr->{'owner'} = git_get_project_owner("$pr->{'path'}");
- }
-
- my ($path, $owner) = ($pr->{'path'}, $pr->{'owner'});
+ my $path = $pr->{'path'};
# quote as in CGI::Util::encode, but keep the slash, and use '+' for ' '
$path =~ s/([^a-zA-Z0-9_.\-\/ ])/sprintf("%%%02X", ord($1))/eg;
- $owner =~ s/([^a-zA-Z0-9_.\-\/ ])/sprintf("%%%02X", ord($1))/eg;
$path =~ s/ /\+/g;
- $owner =~ s/ /\+/g;
-
- print "$path $owner\n";
+ print "$path\n";
}
}
@@ -6579,8 +6533,6 @@ sub git_summary {
my $head = $co{'id'};
my $remote_heads = gitweb_check_feature('remote_heads');
- my $owner = git_get_project_owner($project);
-
my $refs = git_get_references();
# These get_*_list functions return one more to allow us to see if
# there are more ...
@@ -6606,9 +6558,6 @@ sub git_summary {
print "<div class=\"title\">&nbsp;</div>\n";
print "<table class=\"projects_list\">\n" .
"<tr id=\"metadata_desc\"><td>description</td><td>" . esc_html($descr) . "</td></tr>\n";
- if ($owner and not $omit_owner) {
- print "<tr id=\"metadata_owner\"><td>owner</td><td>" . esc_html($owner) . "</td></tr>\n";
- }
if (defined $cd{'rfc2822'}) {
print "<tr id=\"metadata_lchange\"><td>last change</td>" .
"<td>".format_timestamp_html(\%cd)."</td></tr>\n";
@@ -6646,7 +6595,7 @@ sub git_summary {
if (!$prevent_xss && -s "$projectroot/$project/README.html") {
print "<div class=\"title\">readme</div>\n" .
"<div class=\"readme\">\n";
- insert_file("$projectroot/$project/README.html");
+ insert_file("$projectroot/$project/README.md");
print "\n</div>\n"; # class="readme"
}
@@ -6723,8 +6672,11 @@ sub git_tag {
}
print "</div>\n";
git_footer_html();
+
}
+
+
sub git_blame_common {
my $format = shift || 'porcelain';
if ($format eq 'porcelain' && $input_params{'javascript'}) {
@@ -6874,7 +6826,7 @@ sub git_blame_common {
# the header: <SHA-1> <src lineno> <dst lineno> [<lines in group>]
# no <lines in group> for subsequent lines in group of lines
my ($full_rev, $orig_lineno, $lineno, $group_size) =
- ($line =~ /^($oid_regex) (\d+) (\d+)(?: (\d+))?$/);
+ ($line =~ /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/);
if (!exists $metainfo{$full_rev}) {
$metainfo{$full_rev} = { 'nprevious' => 0 };
}
@@ -6924,7 +6876,7 @@ sub git_blame_common {
}
# 'previous' <sha1 of parent commit> <filename at commit>
if (exists $meta->{'previous'} &&
- $meta->{'previous'} =~ /^($oid_regex) (.*)$/) {
+ $meta->{'previous'} =~ /^([a-fA-F0-9]{40}) (.*)$/) {
$meta->{'parent'} = $1;
$meta->{'file_parent'} = unquote($2);
}
@@ -7041,7 +6993,7 @@ sub git_blob_plain {
} else {
die_error(400, "No file name defined");
}
- } elsif ($hash =~ m/^$oid_regex$/) {
+ } elsif ($hash =~ m/^[0-9a-fA-F]{40}$/) {
# blobs defined by non-textual hash id's can be cached
$expires = "+1d";
}
@@ -7102,7 +7054,7 @@ sub git_blob {
} else {
die_error(400, "No file name defined");
}
- } elsif ($hash =~ m/^$oid_regex$/) {
+ } elsif ($hash =~ m/^[0-9a-fA-F]{40}$/) {
# blobs defined by non-textual hash id's can be cached
$expires = "+1d";
}
@@ -7163,8 +7115,8 @@ sub git_blob {
print qq! alt="!.esc_attr($file_name).qq!" title="!.esc_attr($file_name).qq!"!;
}
print qq! src="! .
- esc_attr(href(action=>"blob_plain", hash=>$hash,
- hash_base=>$hash_base, file_name=>$file_name)) .
+ href(action=>"blob_plain", hash=>$hash,
+ hash_base=>$hash_base, file_name=>$file_name) .
qq!" />\n!;
} else {
my $nr;
@@ -7560,7 +7512,7 @@ sub git_commit {
# non-textual hash id's can be cached
my $expires;
- if ($hash =~ m/^$oid_regex$/) {
+ if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
$expires = "+1d";
}
my $refs = git_get_references();
@@ -7654,7 +7606,7 @@ sub git_object {
close $fd;
#'100644 blob 0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa panic.c'
- unless ($line && $line =~ m/^([0-9]+) (.+) ($oid_regex)\t/) {
+ unless ($line && $line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t/) {
die_error(404, "File or directory for given base does not exist");
}
$type = $2;
@@ -7694,7 +7646,7 @@ sub git_blobdiff {
or die_error(404, "Blob diff not found");
} elsif (defined $hash &&
- $hash =~ $oid_regex) {
+ $hash =~ /[0-9a-fA-F]{40}/) {
# try to find filename from $hash
# read filtered raw output
@@ -7704,7 +7656,7 @@ sub git_blobdiff {
@difftree =
# ':100644 100644 03b21826... 3b93d5e7... M ls-files.c'
# $hash == to_id
- grep { /^:[0-7]{6} [0-7]{6} $oid_regex $hash/ }
+ grep { /^:[0-7]{6} [0-7]{6} [0-9a-fA-F]{40} $hash/ }
map { chomp; $_ } <$fd>;
close $fd
or die_error(404, "Reading git-diff-tree failed");
@@ -7727,8 +7679,8 @@ sub git_blobdiff {
$hash ||= $diffinfo{'to_id'};
# non-textual hash id's can be cached
- if ($hash_base =~ m/^$oid_regex$/ &&
- $hash_parent_base =~ m/^$oid_regex$/) {
+ if ($hash_base =~ m/^[0-9a-fA-F]{40}$/ &&
+ $hash_parent_base =~ m/^[0-9a-fA-F]{40}$/) {
$expires = '+1d';
}
@@ -7864,7 +7816,7 @@ sub git_commitdiff {
$hash_parent ne '-c' && $hash_parent ne '--cc') {
# commitdiff with two commits given
my $hash_parent_short = $hash_parent;
- if ($hash_parent =~ m/^$oid_regex$/) {
+ if ($hash_parent =~ m/^[0-9a-fA-F]{40}$/) {
$hash_parent_short = substr($hash_parent, 0, 7);
}
$formats_nav .=
@@ -7973,7 +7925,7 @@ sub git_commitdiff {
# non-textual hash id's can be cached
my $expires;
- if ($hash =~ m/^$oid_regex$/) {
+ if ($hash =~ m/^[0-9a-fA-F]{40}$/) {
$expires = "+1d";
}
@@ -8235,9 +8187,6 @@ sub git_feed {
($format eq 'rss' ? 'RSS' : 'Atom') .
" feed";
}
- my $owner = git_get_project_owner($project);
- $owner = esc_html($owner);
-
#header
my $alt_url;
if (defined $file_name) {
@@ -8247,7 +8196,6 @@ sub git_feed {
} else {
$alt_url = href(-full=>1, action=>"summary");
}
- $alt_url = esc_attr($alt_url);
print qq!<?xml version="1.0" encoding="utf-8"?>\n!;
if ($format eq 'rss') {
print <<XML;
@@ -8259,7 +8207,7 @@ XML
"<description>$descr</description>\n" .
"<language>en</language>\n" .
# project owner is responsible for 'editorial' content
- "<managingEditor>$owner</managingEditor>\n";
+ "<managingEditor>anon</managingEditor>\n";
if (defined $logo || defined $favicon) {
# prefer the logo to the favicon, since RSS
# doesn't allow both
@@ -8285,9 +8233,9 @@ XML
$alt_url . '" />' . "\n" .
'<link rel="self" type="' . $content_type . '" href="' .
$cgi->self_url() . '" />' . "\n" .
- "<id>" . esc_url(href(-full=>1)) . "</id>\n" .
+ "<id>" . href(-full=>1) . "</id>\n" .
# use project owner for feed author
- "<author><name>$owner</name></author>\n";
+ "<author><name>anon</name></author>\n";
if (defined $favicon) {
print "<icon>" . esc_url($favicon) . "</icon>\n";
}
@@ -8331,7 +8279,7 @@ XML
"<author>" . esc_html($co{'author'}) . "</author>\n" .
"<pubDate>$cd{'rfc2822'}</pubDate>\n" .
"<guid isPermaLink=\"true\">$co_url</guid>\n" .
- "<link>" . esc_html($co_url) . "</link>\n" .
+ "<link>$co_url</link>\n" .
"<description>" . esc_html($co{'title'}) . "</description>\n" .
"<content:encoded>" .
"<![CDATA[\n";
@@ -8353,8 +8301,8 @@ XML
}
print "</contributor>\n" .
"<published>$cd{'iso-8601'}</published>\n" .
- "<link rel=\"alternate\" type=\"text/html\" href=\"" . esc_attr($co_url) . "\" />\n" .
- "<id>" . esc_html($co_url) . "</id>\n" .
+ "<link rel=\"alternate\" type=\"text/html\" href=\"$co_url\" />\n" .
+ "<id>$co_url</id>\n" .
"<content type=\"xhtml\" xml:base=\"" . esc_url($my_url) . "\">\n" .
"<div xmlns=\"http://www.w3.org/1999/xhtml\">\n";
}
@@ -8461,8 +8409,8 @@ XML
}
my $path = esc_html(chop_str($proj{'path'}, 25, 5));
- my $rss = esc_attr(href('project' => $proj{'path'}, 'action' => 'rss', -full => 1));
- my $html = esc_attr(href('project' => $proj{'path'}, 'action' => 'summary', -full => 1));
+ my $rss = href('project' => $proj{'path'}, 'action' => 'rss', -full => 1);
+ my $html = href('project' => $proj{'path'}, 'action' => 'summary', -full => 1);
print "<outline type=\"rss\" text=\"$path\" title=\"$path\" xmlUrl=\"$rss\" htmlUrl=\"$html\"/>\n";
}
print <<XML;
@@ -8471,3 +8419,4 @@ XML
</opml>
XML
}
+