gitweb: Whitespace cleanup: realign, reindent
This patch tries (but no too hard) to fit gitweb source in 80 columns, for 2 columns wide tabs, and indent and align source for better readibility. While at it added comment to 'snapshot' entry defaults for %feature hash, corrected "blobl" action in git_blame2 and git_blame to "blob", key of argument to $cgi->a from 'class' to '-class'. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
Aug 22, 2006 at 16:52 UTC
952c65fc0201c3d506f7c4d7377ec2d8bb346d4b
1 file changed
+178
-79
gitweb/gitweb.perl
+178
-79
@@ -69,22 +69,30 @@ our $mimetypes_file = undef;
69
70
# You define site-wide feature defaults here; override them with
71
# $GITWEB_CONFIG as necessary.
72
-our %feature =
73
-(
74
-
75
-# feature => {'sub' => feature-sub, 'override' => allow-override, 'default' => [ default options...]
76
-
77
-'blame' => {'sub' => \&feature_blame, 'override' => 0, 'default' => [0]},
78
-'snapshot' => {'sub' => \&feature_snapshot, 'override' => 0, 'default' => ['x-gzip', 'gz', 'gzip']},
79
-
72
+our %feature = (
73
+ # feature => {'sub' => feature-sub, 'override' => allow-override, 'default' => [ default options...]
74
+ # if feature is overridable, feature-sub will be called with default options;
75
+ # return value indicates if to enable specified feature
76
+
77
+ 'blame' => {
78
+ 'sub' => \&feature_blame,
79
+ 'override' => 0,
80
+ 'default' => [0]},
81
+
82
+ 'snapshot' => {
83
+ 'sub' => \&feature_snapshot,
84
+ 'override' => 0,
85
+ # => [content-encoding, suffix, program]
86
+ 'default' => ['x-gzip', 'gz', 'gzip']},
87
);
88
89
sub gitweb_check_feature {
90
my ($name) = @_;
91
return undef unless exists $feature{$name};
85
- my ($sub, $override, @defaults) = ($feature{$name}{'sub'},
86
- $feature{$name}{'override'},
87
- @{$feature{$name}{'default'}});
92
+ my ($sub, $override, @defaults) = (
93
+ $feature{$name}{'sub'},
94
+ $feature{$name}{'override'},
95
+ @{$feature{$name}{'default'}});
96
if (!$override) { return @defaults; }
97
return $sub->(@defaults);
98
}
@@ -463,7 +471,9 @@ sub format_log_line_html {
471
if ($line =~ m/([0-9a-fA-F]{40})/) {
472
my $hash_text = $1;
473
if (git_get_type($hash_text) eq "commit") {
466
- my $link = $cgi->a({-class => "text", -href => href(action=>"commit", hash=>$hash_text)}, $hash_text);
474
+ my $link =
475
+ $cgi->a({-href => href(action=>"commit", hash=>$hash_text),
476
+ -class => "text"}, $hash_text);
477
$line =~ s/$hash_text/$link/;
478
}
479
}
@@ -734,8 +744,10 @@ sub parse_date {
744
$date{'mday'} = $mday;
745
$date{'day'} = $days[$wday];
746
$date{'month'} = $months[$mon];
737
- $date{'rfc2822'} = sprintf "%s, %d %s %4d %02d:%02d:%02d +0000", $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;
738
- $date{'mday-time'} = sprintf "%d %s %02d:%02d", $mday, $months[$mon], $hour ,$min;
747
+ $date{'rfc2822'} = sprintf "%s, %d %s %4d %02d:%02d:%02d +0000",
748
+ $days[$wday], $mday, $months[$mon], 1900+$year, $hour ,$min, $sec;
749
+ $date{'mday-time'} = sprintf "%d %s %02d:%02d",
750
+ $mday, $months[$mon], $hour ,$min;
751
752
$tz =~ m/^([+\-][0-9][0-9])([0-9][0-9])$/;
753
my $local = $epoch + ((int $1 + ($2/60)) * 3600);
@@ -792,7 +804,8 @@ sub parse_commit {
804
@commit_lines = @$commit_text;
805
} else {
806
$/ = "\0";
795
- open my $fd, "-|", $GIT, "rev-list", "--header", "--parents", "--max-count=1", $commit_id or return;
807
+ open my $fd, "-|", $GIT, "rev-list", "--header", "--parents", "--max-count=1", $commit_id
808
+ or return;
809
@commit_lines = split '\n', <$fd>;
810
close $fd or return;
811
$/ = "\n";
@@ -1086,12 +1099,15 @@ sub git_header_html {
1099
# 'application/xhtml+xml', otherwise send it as plain old 'text/html'.
1100
# we have to do this because MSIE sometimes globs '*/*', pretending to
1101
# support xhtml+xml but choking when it gets what it asked for.
1089
- if (defined $cgi->http('HTTP_ACCEPT') && $cgi->http('HTTP_ACCEPT') =~ m/(,|;|\s|^)application\/xhtml\+xml(,|;|\s|$)/ && $cgi->Accept('application/xhtml+xml') != 0) {
1102
+ if (defined $cgi->http('HTTP_ACCEPT') &&
1103
+ $cgi->http('HTTP_ACCEPT') =~ m/(,|;|\s|^)application\/xhtml\+xml(,|;|\s|$)/ &&
1104
+ $cgi->Accept('application/xhtml+xml') != 0) {
1105
$content_type = 'application/xhtml+xml';
1106
} else {
1107
$content_type = 'text/html';
1108
}
1094
- print $cgi->header(-type=>$content_type, -charset => 'utf-8', -status=> $status, -expires => $expires);
1109
+ print $cgi->header(-type=>$content_type, -charset => 'utf-8',
1110
+ -status=> $status, -expires => $expires);
1111
print <<EOF;
1112
<?xml version="1.0" encoding="utf-8"?>
1113
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -1271,9 +1287,12 @@ sub git_print_page_path {
1287
} elsif (defined $type && $type eq 'blob') {
1288
print "<div class=\"page_path\">";
1289
if (defined $hb) {
1274
- print $cgi->a({-href => href(action=>"blob_plain", hash_base=>$hb, file_name=>$file_name)}, esc_html($name));
1290
+ print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
1291
+ hash_base=>$hb)},
1292
+ esc_html($name));
1293
} else {
1276
- print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name)}, esc_html($name));
1294
+ print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name)},
1295
+ esc_html($name));
1296
}
1297
print "<br/></div>\n";
1298
} else {
@@ -1523,7 +1542,8 @@ sub git_shortlog_body {
1542
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
1543
"<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
1544
"<td>";
1526
- print format_subject_html($co{'title'}, $co{'title_short'}, href(action=>"commit", hash=>$commit), $ref);
1545
+ print format_subject_html($co{'title'}, $co{'title_short'},
1546
+ href(action=>"commit", hash=>$commit), $ref);
1547
print "</td>\n" .
1548
"<td class=\"link\">" .
1549
$cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
@@ -1572,7 +1592,8 @@ sub git_history_body {
1592
"<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" .
1593
"<td>";
1594
# originally git_history used chop_str($co{'title'}, 50)
1575
- print format_subject_html($co{'title'}, $co{'title_short'}, href(action=>"commit", hash=>$commit), $ref);
1595
+ print format_subject_html($co{'title'}, $co{'title_short'},
1596
+ href(action=>"commit", hash=>$commit), $ref);
1597
print "</td>\n" .
1598
"<td class=\"link\">" .
1599
$cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
@@ -1585,7 +1606,8 @@ sub git_history_body {
1606
if (defined $blob_current && defined $blob_parent &&
1607
$blob_current ne $blob_parent) {
1608
print " | " .
1588
- $cgi->a({-href => href(action=>"blobdiff", hash=>$blob_current, hash_parent=>$blob_parent, hash_base=>$commit, file_name=>$file_name)},
1609
+ $cgi->a({-href => href(action=>"blobdiff", hash=>$blob_current, hash_parent=>$blob_parent,
1610
+ hash_base=>$commit, file_name=>$file_name)},
1611
"diff to current");
1612
}
1613
}
@@ -1630,7 +1652,8 @@ sub git_tags_body {
1652
"</td>\n" .
1653
"<td>";
1654
if (defined $comment) {
1633
- print format_subject_html($comment, $comment_short, href(action=>"tag", hash=>$tag{'id'}));
1655
+ print format_subject_html($comment, $comment_short,
1656
+ href(action=>"tag", hash=>$tag{'id'}));
1657
}
1658
print "</td>\n" .
1659
"<td class=\"selflink\">";
@@ -1941,13 +1964,17 @@ sub git_tag {
1964
"<table cellspacing=\"0\">\n" .
1965
"<tr>\n" .
1966
"<td>object</td>\n" .
1944
- "<td>" . $cgi->a({-class => "list", -href => href(action=>$tag{'type'}, hash=>$tag{'object'})}, $tag{'object'}) . "</td>\n" .
1945
- "<td class=\"link\">" . $cgi->a({-href => href(action=>$tag{'type'}, hash=>$tag{'object'})}, $tag{'type'}) . "</td>\n" .
1967
+ "<td>" . $cgi->a({-class => "list", -href => href(action=>$tag{'type'}, hash=>$tag{'object'})},
1968
+ $tag{'object'}) . "</td>\n" .
1969
+ "<td class=\"link\">" . $cgi->a({-href => href(action=>$tag{'type'}, hash=>$tag{'object'})},
1970
+ $tag{'type'}) . "</td>\n" .
1971
"</tr>\n";
1972
if (defined($tag{'author'})) {
1973
my %ad = parse_date($tag{'epoch'}, $tag{'tz'});
1974
print "<tr><td>author</td><td>" . esc_html($tag{'author'}) . "</td></tr>\n";
1950
- print "<tr><td></td><td>" . $ad{'rfc2822'} . sprintf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'}) . "</td></tr>\n";
1975
+ print "<tr><td></td><td>" . $ad{'rfc2822'} .
1976
+ sprintf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'}) .
1977
+ "</td></tr>\n";
1978
}
1979
print "</table>\n\n" .
1980
"</div>\n";
@@ -1984,8 +2011,11 @@ sub git_blame2 {
2011
or die_error(undef, "Open git-blame failed");
2012
git_header_html();
2013
my $formats_nav =
1987
- $cgi->a({-href => href(action=>"blobl", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)}, "blob") .
1988
- " | " . $cgi->a({-href => href(action=>"blame", file_name=>$file_name)}, "head");
2014
+ $cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
2015
+ "blob") .
2016
+ " | " .
2017
+ $cgi->a({-href => href(action=>"blame", file_name=>$file_name)},
2018
+ "head");
2019
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
2020
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
2021
git_print_page_path($file_name, $ftype, $hash_base);
@@ -2011,14 +2041,17 @@ sub git_blame2 {
2041
}
2042
print "<tr class=\"$rev_color[$current_color]\">\n";
2043
print "<td class=\"sha1\">" .
2014
- $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)}, esc_html($rev)) . "</td>\n";
2015
- print "<td class=\"linenr\"><a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" . esc_html($lineno) . "</a></td>\n";
2044
+ $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)},
2045
+ esc_html($rev)) . "</td>\n";
2046
+ print "<td class=\"linenr\"><a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" .
2047
+ esc_html($lineno) . "</a></td>\n";
2048
print "<td class=\"pre\">" . esc_html($data) . "</td>\n";
2049
print "</tr>\n";
2050
}
2051
print "</table>\n";
2052
print "</div>";
2021
- close $fd or print "Reading blob failed\n";
2053
+ close $fd
2054
+ or print "Reading blob failed\n";
2055
git_footer_html();
2056
}
2057
@@ -2041,8 +2074,11 @@ sub git_blame {
2074
or die_error(undef, "Open git-annotate failed");
2075
git_header_html();
2076
my $formats_nav =
2044
- $cgi->a({-href => href(action=>"blobl", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)}, "blob") .
2045
- " | " . $cgi->a({-href => href(action=>"blame", file_name=>$file_name)}, "head");
2077
+ $cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)},
2078
+ "blob") .
2079
+ " | " .
2080
+ $cgi->a({-href => href(action=>"blame", file_name=>$file_name)},
2081
+ "head");
2082
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
2083
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
2084
git_print_page_path($file_name, 'blob', $hash_base);
@@ -2106,7 +2142,8 @@ HTML
2142
HTML
2143
} # while (my $line = <$fd>)
2144
print "</table>\n\n";
2109
- close $fd or print "Reading blob failed.\n";
2145
+ close $fd
2146
+ or print "Reading blob failed.\n";
2147
print "</div>";
2148
git_footer_html();
2149
}
@@ -2193,13 +2230,23 @@ sub git_blob {
2230
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
2231
if (defined $file_name) {
2232
if ($have_blame) {
2196
- $formats_nav .= $cgi->a({-href => href(action=>"blame", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)}, "blame") . " | ";
2233
+ $formats_nav .=
2234
+ $cgi->a({-href => href(action=>"blame", hash_base=>$hash_base,
2235
+ hash=>$hash, file_name=>$file_name)},
2236
+ "blame") .
2237
+ " | ";
2238
}
2239
$formats_nav .=
2199
- $cgi->a({-href => href(action=>"blob_plain", hash=>$hash, file_name=>$file_name)}, "plain") .
2200
- " | " . $cgi->a({-href => href(action=>"blob", hash_base=>"HEAD", file_name=>$file_name)}, "head");
2240
+ $cgi->a({-href => href(action=>"blob_plain",
2241
+ hash=>$hash, file_name=>$file_name)},
2242
+ "plain") .
2243
+ " | " .
2244
+ $cgi->a({-href => href(action=>"blob",
2245
+ hash_base=>"HEAD", file_name=>$file_name)},
2246
+ "head");
2247
} else {
2202
- $formats_nav .= $cgi->a({-href => href(action=>"blob_plain", hash=>$hash)}, "plain");
2248
+ $formats_nav .=
2249
+ $cgi->a({-href => href(action=>"blob_plain", hash=>$hash)}, "plain");
2250
}
2251
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
2252
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
@@ -2215,9 +2262,11 @@ sub git_blob {
2262
chomp $line;
2263
$nr++;
2264
$line = untabify($line);
2218
- printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n", $nr, $nr, $nr, esc_html($line);
2265
+ printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n",
2266
+ $nr, $nr, $nr, esc_html($line);
2267
}
2220
- close $fd or print "Reading blob failed.\n";
2268
+ close $fd
2269
+ or print "Reading blob failed.\n";
2270
print "</div>";
2271
git_footer_html();
2272
}
@@ -2278,23 +2327,37 @@ sub git_tree {
2327
print "<td class=\"mode\">" . mode_str($t_mode) . "</td>\n";
2328
if ($t_type eq "blob") {
2329
print "<td class=\"list\">" .
2281
- $cgi->a({-href => href(action=>"blob", hash=>$t_hash, file_name=>"$base$t_name", %base_key), -class => "list"}, esc_html($t_name)) .
2330
+ $cgi->a({-href => href(action=>"blob", hash=>$t_hash, file_name=>"$base$t_name", %base_key),
2331
+ -class => "list"}, esc_html($t_name)) .
2332
"</td>\n" .
2333
"<td class=\"link\">" .
2284
- $cgi->a({-href => href(action=>"blob", hash=>$t_hash, file_name=>"$base$t_name", %base_key)}, "blob");
2334
+ $cgi->a({-href => href(action=>"blob", hash=>$t_hash, file_name=>"$base$t_name", %base_key)},
2335
+ "blob");
2336
if ($have_blame) {
2286
- print " | " . $cgi->a({-href => href(action=>"blame", hash=>$t_hash, file_name=>"$base$t_name", %base_key)}, "blame");
2337
+ print " | " .
2338
+ $cgi->a({-href => href(action=>"blame", hash=>$t_hash, file_name=>"$base$t_name", %base_key)},
2339
+ "blame");
2340
}
2288
- print " | " . $cgi->a({-href => href(action=>"history", hash=>$t_hash, hash_base=>$hash_base, file_name=>"$base$t_name")}, "history") .
2289
- " | " . $cgi->a({-href => href(action=>"blob_plain", hash=>$t_hash, file_name=>"$base$t_name")}, "raw") .
2341
+ print " | " .
2342
+ $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
2343
+ hash=>$t_hash, file_name=>"$base$t_name")},
2344
+ "history") .
2345
+ " | " .
2346
+ $cgi->a({-href => href(action=>"blob_plain",
2347
+ hash=>$t_hash, file_name=>"$base$t_name")},
2348
+ "raw") .
2349
"</td>\n";
2350
} elsif ($t_type eq "tree") {
2351
print "<td class=\"list\">" .
2293
- $cgi->a({-href => href(action=>"tree", hash=>$t_hash, file_name=>"$base$t_name", %base_key)}, esc_html($t_name)) .
2352
+ $cgi->a({-href => href(action=>"tree", hash=>$t_hash, file_name=>"$base$t_name", %base_key)},
2353
+ esc_html($t_name)) .
2354
"</td>\n" .
2355
"<td class=\"link\">" .
2296
- $cgi->a({-href => href(action=>"tree", hash=>$t_hash, file_name=>"$base$t_name", %base_key)}, "tree") .
2297
- " | " . $cgi->a({-href => href(action=>"history", hash_base=>$hash_base, file_name=>"$base$t_name")}, "history") .
2356
+ $cgi->a({-href => href(action=>"tree", hash=>$t_hash, file_name=>"$base$t_name", %base_key)},
2357
+ "tree") .
2358
+ " | " .
2359
+ $cgi->a({-href => href(action=>"history", hash_base=>$hash_base, file_name=>"$base$t_name")},
2360
+ "history") .
2361
"</td>\n";
2362
}
2363
print "</tr>\n";
@@ -2319,10 +2382,9 @@ sub git_snapshot {
2382
my $filename = basename($project) . "-$hash.tar.$suffix";
2383
2384
print $cgi->header(-type => 'application/x-tar',
2322
- -content-encoding => $ctype,
2323
- '-content-disposition' =>
2324
- "inline; filename=\"$filename\"",
2325
- -status => '200 OK');
2385
+ -content-encoding => $ctype,
2386
+ '-content-disposition' => "inline; filename=\"$filename\"",
2387
+ -status => '200 OK');
2388
2389
open my $fd, "-|", "$GIT tar-tree $hash \'$project\' | $command" or
2390
die_error(undef, "Execute git-tar-tree failed.");
@@ -2373,7 +2435,8 @@ sub git_log {
2435
print "<div class=\"title_text\">\n" .
2436
"<div class=\"log_link\">\n" .
2437
$cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") .
2376
- " | " . $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") .
2438
+ " | " .
2439
+ $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") .
2440
"<br/>\n" .
2441
"</div>\n" .
2442
"<i>" . esc_html($co{'author_name'}) . " [$ad{'rfc2822'}]</i><br/>\n" .
@@ -2417,12 +2480,14 @@ sub git_commit {
2480
my $formats_nav = '';
2481
if (defined $file_name && defined $co{'parent'}) {
2482
my $parent = $co{'parent'};
2420
- $formats_nav .= $cgi->a({-href => href(action=>"blame", hash_parent=>$parent, file_name=>$file_name)}, "blame");
2483
+ $formats_nav .=
2484
+ $cgi->a({-href => href(action=>"blame", hash_parent=>$parent, file_name=>$file_name)},
2485
+ "blame");
2486
}
2487
git_header_html(undef, $expires);
2488
git_print_page_nav('commit', defined $co{'parent'} ? '' : 'commitdiff',
2424
- $hash, $co{'tree'}, $hash,
2425
- $formats_nav);
2489
+ $hash, $co{'tree'}, $hash,
2490
+ $formats_nav);
2491
2492
if (defined $co{'parent'}) {
2493
git_print_header_div('commitdiff', esc_html($co{'title'}) . $ref, $hash);
@@ -2435,23 +2500,31 @@ sub git_commit {
2500
"<tr>" .
2501
"<td></td><td> $ad{'rfc2822'}";
2502
if ($ad{'hour_local'} < 6) {
2438
- printf(" (<span class=\"atnight\">%02d:%02d</span> %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
2503
+ printf(" (<span class=\"atnight\">%02d:%02d</span> %s)",
2504
+ $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
2505
} else {
2440
- printf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
2506
+ printf(" (%02d:%02d %s)",
2507
+ $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'});
2508
}
2509
print "</td>" .
2510
"</tr>\n";
2511
print "<tr><td>committer</td><td>" . esc_html($co{'committer'}) . "</td></tr>\n";
2445
- print "<tr><td></td><td> $cd{'rfc2822'}" . sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) . "</td></tr>\n";
2512
+ print "<tr><td></td><td> $cd{'rfc2822'}" .
2513
+ sprintf(" (%02d:%02d %s)", $cd{'hour_local'}, $cd{'minute_local'}, $cd{'tz_local'}) .
2514
+ "</td></tr>\n";
2515
print "<tr><td>commit</td><td class=\"sha1\">$co{'id'}</td></tr>\n";
2516
print "<tr>" .
2517
"<td>tree</td>" .
2518
"<td class=\"sha1\">" .
2450
- $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$hash), class => "list"}, $co{'tree'}) .
2519
+ $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$hash),
2520
+ class => "list"}, $co{'tree'}) .
2521
"</td>" .
2452
- "<td class=\"link\">" . $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$hash)}, "tree");
2522
+ "<td class=\"link\">" .
2523
+ $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$hash)},
2524
+ "tree");
2525
if ($have_snapshot) {
2454
- print " | " . $cgi->a({-href => href(action=>"snapshot", hash=>$hash)}, "snapshot");
2526
+ print " | " .
2527
+ $cgi->a({-href => href(action=>"snapshot", hash=>$hash)}, "snapshot");
2528
}
2529
print "</td>" .
2530
"</tr>\n";
@@ -2459,10 +2532,14 @@ sub git_commit {
2532
foreach my $par (@$parents) {
2533
print "<tr>" .
2534
"<td>parent</td>" .
2462
- "<td class=\"sha1\">" . $cgi->a({-href => href(action=>"commit", hash=>$par), class => "list"}, $par) . "</td>" .
2535
+ "<td class=\"sha1\">" .
2536
+ $cgi->a({-href => href(action=>"commit", hash=>$par),
2537
+ class => "list"}, $par) .
2538
+ "</td>" .
2539
"<td class=\"link\">" .
2540
$cgi->a({-href => href(action=>"commit", hash=>$par)}, "commit") .
2465
- " | " . $cgi->a({-href => href(action=>"commitdiff", hash=>$hash, hash_parent=>$par)}, "commitdiff") .
2541
+ " | " .
2542
+ $cgi->a({-href => href(action=>"commitdiff", hash=>$hash, hash_parent=>$par)}, "commitdiff") .
2543
"</td>" .
2544
"</tr>\n";
2545
}
@@ -2483,7 +2560,9 @@ sub git_blobdiff {
2560
git_header_html();
2561
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
2562
my $formats_nav =
2486
- $cgi->a({-href => href(action=>"blobdiff_plain", hash=>$hash, hash_parent=>$hash_parent)}, "plain");
2563
+ $cgi->a({-href => href(action=>"blobdiff_plain",
2564
+ hash=>$hash, hash_parent=>$hash_parent)},
2565
+ "plain");
2566
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
2567
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
2568
} else {
@@ -2494,12 +2573,16 @@ sub git_blobdiff {
2573
git_print_page_path($file_name, "blob", $hash_base);
2574
print "<div class=\"page_body\">\n" .
2575
"<div class=\"diff_info\">blob:" .
2497
- $cgi->a({-href => href(action=>"blob", hash=>$hash_parent, hash_base=>$hash_base, file_name=>($file_parent || $file_name))}, $hash_parent) .
2576
+ $cgi->a({-href => href(action=>"blob", hash=>$hash_parent,
2577
+ hash_base=>$hash_base, file_name=>($file_parent || $file_name))},
2578
+ $hash_parent) .
2579
" -> blob:" .
2499
- $cgi->a({-href => href(action=>"blob", hash=>$hash, hash_base=>$hash_base, file_name=>$file_name)}, $hash) .
2580
+ $cgi->a({-href => href(action=>"blob", hash=>$hash,
2581
+ hash_base=>$hash_base, file_name=>$file_name)},
2582
+ $hash) .
2583
"</div>\n";
2584
git_diff_print($hash_parent, $file_name || $hash_parent, $hash, $file_name || $hash);
2502
- print "</div>";
2585
+ print "</div>"; # page_body
2586
git_footer_html();
2587
}
2588
@@ -2531,7 +2614,8 @@ sub git_commitdiff {
2614
my $refs = git_get_references();
2615
my $ref = format_ref_marker($refs, $co{'id'});
2616
my $formats_nav =
2534
- $cgi->a({-href => href(action=>"commitdiff_plain", hash=>$hash, hash_parent=>$hash_parent)}, "plain");
2617
+ $cgi->a({-href => href(action=>"commitdiff_plain", hash=>$hash, hash_parent=>$hash_parent)},
2618
+ "plain");
2619
git_header_html(undef, $expires);
2620
git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);
2621
git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash);
@@ -2552,22 +2636,30 @@ sub git_commitdiff {
2636
my $file = validate_input(unquote($6));
2637
if ($status eq "A") {
2638
print "<div class=\"diff_info\">" . file_type($to_mode) . ":" .
2555
- $cgi->a({-href => href(action=>"blob", hash=>$to_id, hash_base=>$hash, file_name=>$file)}, $to_id) . "(new)" .
2639
+ $cgi->a({-href => href(action=>"blob", hash_base=>$hash,
2640
+ hash=>$to_id, file_name=>$file)},
2641
+ $to_id) . "(new)" .
2642
"</div>\n";
2643
git_diff_print(undef, "/dev/null", $to_id, "b/$file");
2644
} elsif ($status eq "D") {
2645
print "<div class=\"diff_info\">" . file_type($from_mode) . ":" .
2560
- $cgi->a({-href => href(action=>"blob", hash=>$from_id, hash_base=>$hash_parent, file_name=>$file)}, $from_id) . "(deleted)" .
2646
+ $cgi->a({-href => href(action=>"blob", hash_base=>$hash_parent,
2647
+ hash=>$from_id, file_name=>$file)},
2648
+ $from_id) . "(deleted)" .
2649
"</div>\n";
2650
git_diff_print($from_id, "a/$file", undef, "/dev/null");
2651
} elsif ($status eq "M") {
2652
if ($from_id ne $to_id) {
2653
print "<div class=\"diff_info\">" .
2654
file_type($from_mode) . ":" .
2567
- $cgi->a({-href => href(action=>"blob", hash=>$from_id, hash_base=>$hash_parent, file_name=>$file)}, $from_id) .
2655
+ $cgi->a({-href => href(action=>"blob", hash_base=>$hash_parent,
2656
+ hash=>$from_id, file_name=>$file)},
2657
+ $from_id) .
2658
" -> " .
2659
file_type($to_mode) . ":" .
2570
- $cgi->a({-href => href(action=>"blob", hash=>$to_id, hash_base=>$hash, file_name=>$file)}, $to_id);
2660
+ $cgi->a({-href => href(action=>"blob", hash_base=>$hash,
2661
+ hash=>$to_id, file_name=>$file)},
2662
+ $to_id);
2663
print "</div>\n";
2664
git_diff_print($from_id, "a/$file", $to_id, "b/$file");
2665
}
@@ -2607,7 +2699,9 @@ sub git_commitdiff_plain {
2699
}
2700
}
2701
2610
- print $cgi->header(-type => "text/plain", -charset => 'utf-8', '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
2702
+ print $cgi->header(-type => "text/plain",
2703
+ -charset => 'utf-8',
2704
+ '-content-disposition' => "inline; filename=\"git-$hash.patch\"");
2705
my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
2706
my $comment = $co{'comment'};
2707
print "From: $co{'author'}\n" .
@@ -2746,7 +2840,8 @@ sub git_search {
2840
print "</td>\n" .
2841
"<td class=\"link\">" .
2842
$cgi->a({-href => href(action=>"commit", hash=>$co{'id'})}, "commit") .
2749
- " | " . $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$co{'id'})}, "tree");
2843
+ " | " .
2844
+ $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$co{'id'})}, "tree");
2845
print "</td>\n" .
2846
"</tr>\n";
2847
}
@@ -2783,18 +2878,22 @@ sub git_search {
2878
print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2879
"<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 5)) . "</i></td>\n" .
2880
"<td>" .
2786
- $cgi->a({-href => href(action=>"commit", hash=>$co{'id'}), -class => "list subject"},
2881
+ $cgi->a({-href => href(action=>"commit", hash=>$co{'id'}),
2882
+ -class => "list subject"},
2883
esc_html(chop_str($co{'title'}, 50)) . "<br/>");
2884
while (my $setref = shift @files) {
2885
my %set = %$setref;
2790
- print $cgi->a({-href => href(action=>"blob", hash=>$set{'id'}, hash_base=>$co{'id'}, file_name=>$set{'file'}), class => "list"},
2791
- "<span class=\"match\">" . esc_html($set{'file'}) . "</span>") .
2886
+ print $cgi->a({-href => href(action=>"blob", hash_base=>$co{'id'},
2887
+ hash=>$set{'id'}, file_name=>$set{'file'}),
2888
+ -class => "list"},
2889
+ "<span class=\"match\">" . esc_html($set{'file'}) . "</span>") .
2890
"<br/>\n";
2891
}
2892
print "</td>\n" .
2893
"<td class=\"link\">" .
2894
$cgi->a({-href => href(action=>"commit", hash=>$co{'id'})}, "commit") .
2797
- " | " . $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$co{'id'})}, "tree");
2895
+ " | " .
2896
+ $cgi->a({-href => href(action=>"tree", hash=>$co{'tree'}, hash_base=>$co{'id'})}, "tree");
2897
print "</td>\n" .
2898
"</tr>\n";
2899
}