# source of projects list
our $projects_list = "++GITWEB_LIST++";
+# default order of projects list
+# valid values are none, project, descr, owner, and age
+our $default_projects_order = "project";
+
# show repository only if this file exists
# (only effective if this variable evaluates to true)
our $export_ok = "++GITWEB_EXPORT_OK++";
return $input;
}
-# very thin wrapper for decode("utf8", $str, Encode::FB_DEFAULT);
-sub to_utf8 {
- my $str = shift;
- return decode("utf8", $str, Encode::FB_DEFAULT);
-}
-
# quote unsafe chars, but keep the slash, even when it's not
# correct, but quoted slashes look too horrible in bookmarks
sub esc_param {
my $str = shift;
my %opts = @_;
- $str = to_utf8($str);
+ $str = decode_utf8($str);
$str = $cgi->escapeHTML($str);
if ($opts{'-nbsp'}) {
$str =~ s/ / /g;
my $str = shift;
my %opts = @_;
- $str = to_utf8($str);
+ $str = decode_utf8($str);
$str = $cgi->escapeHTML($str);
if ($opts{'-nbsp'}) {
$str =~ s/ / /g;
if (length($short) < length($long)) {
return $cgi->a({-href => $href, -class => "list subject",
- -title => to_utf8($long)},
+ -title => decode_utf8($long)},
esc_html($short) . $extra);
} else {
return $cgi->a({-href => $href, -class => "list subject"},
if (check_export_ok("$projectroot/$path")) {
my $pr = {
path => $path,
- owner => to_utf8($owner),
+ owner => decode_utf8($owner),
};
push @list, $pr;
(my $forks_path = $path) =~ s/\.git$//;
}
close $fd;
}
- @list = sort {$a->{'path'} cmp $b->{'path'}} @list;
return @list;
}
$pr = unescape($pr);
$ow = unescape($ow);
if ($pr eq $project) {
- $owner = to_utf8($ow);
+ $owner = decode_utf8($ow);
last;
}
}
}
my $owner = $gcos;
$owner =~ s/[,;].*$//;
- return to_utf8($owner);
+ return decode_utf8($owner);
}
## ......................................................................
my $title = "$site_name";
if (defined $project) {
- $title .= " - " . to_utf8($project);
+ $title .= " - " . decode_utf8($project);
if (defined $action) {
$title .= "/$action";
if (defined $file_name) {
print "<div class=\"page_path\">";
print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
- -title => 'tree root'}, to_utf8("[$project]"));
+ -title => 'tree root'}, decode_utf8("[$project]"));
print " / ";
if (defined $name) {
my @dirname = split '/', $name;
my ($fd, $difftree, $hash, $hash_parent) = @_;
my $patch_idx = 0;
+ my $patch_number = 0;
my $patch_line;
my $diffinfo;
my (%from, %to);
# git diff header
#assert($patch_line =~ m/^diff /) if DEBUG;
#assert($patch_line !~ m!$/$!) if DEBUG; # is chomp-ed
+ $patch_number++;
push @diff_header, $patch_line;
# extended diff header
} continue {
print "</div>\n"; # class="patch"
}
+ print "<div class=\"diff nodifferences\">No differences found</div>\n" if (!$patch_number);
print "</div>\n"; # class="patchset"
}
($pr->{'age'}, $pr->{'age_string'}) = @aa;
if (!defined $pr->{'descr'}) {
my $descr = git_get_project_description($pr->{'path'}) || "";
- $pr->{'descr_long'} = to_utf8($descr);
+ $pr->{'descr_long'} = decode_utf8($descr);
$pr->{'descr'} = chop_str($descr, 25, 5);
}
if (!defined $pr->{'owner'}) {
push @projects, $pr;
}
- $order ||= "project";
+ $order ||= $default_projects_order;
$from = 0 unless defined $from;
$to = $#projects if (!defined $to || $#projects < $to);
sub git_project_list {
my $order = $cgi->param('o');
- if (defined $order && $order !~ m/project|descr|owner|age/) {
+ if (defined $order && $order !~ m/none|project|descr|owner|age/) {
die_error(undef, "Unknown order parameter");
}
sub git_forks {
my $order = $cgi->param('o');
- if (defined $order && $order !~ m/project|descr|owner|age/) {
+ if (defined $order && $order !~ m/none|project|descr|owner|age/) {
die_error(undef, "Unknown order parameter");
}
$hash = git_get_head_hash($project);
}
- my $filename = to_utf8(basename($project)) . "-$hash.tar.$suffix";
+ my $filename = decode_utf8(basename($project)) . "-$hash.tar.$suffix";
print $cgi->header(
-type => "application/$ctype",