1102
$ref_item{'refid'} = $ref_id;
1103
$ref_item{'epoch'} = $co{'committer_epoch'};
1104
$ref_item{'age'} = $co{'age_string'};
1105
+ } else {
1106
+ $ref_item{'reftype'} = $type;
1107
+ $ref_item{'name'} = $ref_file;
1108
+ $ref_item{'refid'} = $ref_id;
1109
}
1110
1111
push @reflist, \%ref_item;
1115
return \@reflist;
1116
}
1117
1118
+sub git_shortlog_body {
1119
+ # uses global variable $project
1120
+ my ($revlist, $from, $to, $refs, $extra) = @_;
1121
+ $from = 0 unless defined $from;
1122
+ $to = $#{$revlist} if (!defined $to || $#{$revlist} < $to);
1123
+
1124
+ print "<table class=\"shortlog\" cellspacing=\"0\">\n";
1125
+ my $alternate = 0;
1126
+ for (my $i = $from; $i <= $to; $i++) {
1127
+ my $commit = $revlist->[$i];
1128
+ #my $ref = defined $refs ? git_get_referencing($refs, $commit) : '';
1129
+ my $ref = git_get_referencing($refs, $commit);
1130
+ my %co = git_read_commit($commit);
1131
+ my %ad = date_str($co{'author_epoch'});
1132
+ if ($alternate) {
1133
+ print "<tr class=\"dark\">\n";
1134
+ } else {
1135
+ print "<tr class=\"light\">\n";
1136
+ }
1137
+ $alternate ^= 1;
1138
+ # git_summary() used print "<td><i>$co{'age_string'}</i></td>\n" .
1139
+ print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
1140
+ "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
1141
+ "<td>";
1142
+ if (length($co{'title_short'}) < length($co{'title'})) {
1143
+ print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"),
1144
+ -class => "list", -title => "$co{'title'}"},
1145
+ "<b>" . esc_html($co{'title_short'}) . "$ref</b>");
1146
+ } else {
1147
+ print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"),
1148
+ -class => "list"},
1149
+ "<b>" . esc_html($co{'title'}) . "$ref</b>");
1150
+ }
1151
+ print "</td>\n" .
1152
+ "<td class=\"link\">" .
1153
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") . " | " .
1154
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
1155
+ "</td>\n" .
1156
+ "</tr>\n";
1157
+ }
1158
+ if (defined $extra) {
1159
+ print "<tr>\n" .
1160
+ "<td colspan=\"4\">$extra</td>\n" .
1161
+ "</tr>\n";
1162
+ }
1163
+ print "</table>\n";
1164
+}
1165
+
1166
+sub git_tags_body {
1167
+ # uses global variable $project
1168
+ my ($taglist, $from, $to, $extra) = @_;
1169
+ $from = 0 unless defined $from;
1170
+ $to = $#{$taglist} if (!defined $to || $#{$taglist} < $to);
1171
+
1172
+ print "<table class=\"tags\" cellspacing=\"0\">\n";
1173
+ my $alternate = 0;
1174
+ for (my $i = $from; $i <= $to; $i++) {
1175
+ my $entry = $taglist->[$i];
1176
+ my %tag = %$entry;
1177
+ my $comment_lines = $tag{'comment'};
1178
+ my $comment = shift @$comment_lines;
1179
+ my $comment_short;
1180
+ if (defined $comment) {
1181
+ $comment_short = chop_str($comment, 30, 5);
1182
+ }
1183
+ if ($alternate) {
1184
+ print "<tr class=\"dark\">\n";
1185
+ } else {
1186
+ print "<tr class=\"light\">\n";
1187
+ }
1188
+ $alternate ^= 1;
1189
+ print "<td><i>$tag{'age'}</i></td>\n" .
1190
+ "<td>" .
1191
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}"),
1192
+ -class => "list"}, "<b>" . esc_html($tag{'name'}) . "</b>") .
1193
+ "</td>\n" .
1194
+ "<td>";
1195
+ if (defined $comment) {
1196
+ if (length($comment_short) < length($comment)) {
1197
+ print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"),
1198
+ -class => "list", -title => $comment}, $comment_short);
1199
+ } else {
1200
+ print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}"),
1201
+ -class => "list"}, $comment);
1202
+ }
1203
+ }
1204
+ print "</td>\n" .
1205
+ "<td class=\"selflink\">";
1206
+ if ($tag{'type'} eq "tag") {
1207
+ print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, "tag");
1208
+ } else {
1209
+ print " ";
1210
+ }
1211
+ print "</td>\n" .
1212
+ "<td class=\"link\">" . " | " .
1213
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1214
+ if ($tag{'reftype'} eq "commit") {
1215
+ print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1216
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log");
1217
+ } elsif ($tag{'reftype'} eq "blob") {
1218
+ print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$tag{'refid'}")}, "raw");
1219
+ }
1220
+ print "</td>\n" .
1221
+ "</tr>";
1222
+ }
1223
+ if (defined $extra) {
1224
+ print "<tr>\n" .
1225
+ "<td colspan=\"5\">$extra</td>\n" .
1226
+ "</tr>\n";
1227
+ }
1228
+ print "</table>\n";
1229
+}
1230
+
1231
+sub git_heads_body {
1232
+ # uses global variable $project
1233
+ my ($taglist, $head, $from, $to, $extra) = @_;
1234
+ $from = 0 unless defined $from;
1235
+ $to = $#{$taglist} if (!defined $to || $#{$taglist} < $to);
1236
+
1237
+ print "<table class=\"heads\" cellspacing=\"0\">\n";
1238
+ my $alternate = 0;
1239
+ for (my $i = $from; $i <= $to; $i++) {
1240
+ my $entry = $taglist->[$i];
1241
+ my %tag = %$entry;
1242
+ my $curr = $tag{'id'} eq $head;
1243
+ if ($alternate) {
1244
+ print "<tr class=\"dark\">\n";
1245
+ } else {
1246
+ print "<tr class=\"light\">\n";
1247
+ }
1248
+ $alternate ^= 1;
1249
+ print "<td><i>$tag{'age'}</i></td>\n" .
1250
+ ($tag{'id'} eq $head ? "<td class=\"current_head\">" : "<td>") .
1251
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}"),
1252
+ -class => "list"}, "<b>" . esc_html($tag{'name'}) . "</b>") .
1253
+ "</td>\n" .
1254
+ "<td class=\"link\">" .
1255
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") . " | " .
1256
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'name'}")}, "log") .
1257
+ "</td>\n" .
1258
+ "</tr>";
1259
+ }
1260
+ if (defined $extra) {
1261
+ print "<tr>\n" .
1262
+ "<td colspan=\"3\">$extra</td>\n" .
1263
+ "</tr>\n";
1264
+ }
1265
+ print "</table>\n";
1266
+}
1267
+
1268
sub git_summary {
1269
my $descr = git_read_description($project) || "none";
1270
my $head = git_read_head($project);
1293
my $refs = read_info_ref();
1294
git_header_html();
1295
git_page_nav('summary','', $head);
1296
+
1297
print "<div class=\"title\"> </div>\n";
1298
print "<table cellspacing=\"0\">\n" .
1299
"<tr><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
1300
"<tr><td>owner</td><td>$owner</td></tr>\n" .
1301
"<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\n" .
1302
"</table>\n";
1303
+
1304
open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_read_head($project)
1305
or die_error(undef, "Open git-rev-list failed.");
1306
my @revlist = map { chomp; $_ } <$fd>;
1307
close $fd;
1308
git_header_div('shortlog');
1153
- my $i = 16;
1154
- print "<table cellspacing=\"0\">\n";
1155
- my $alternate = 0;
1156
- foreach my $commit (@revlist) {
1157
- my %co = git_read_commit($commit);
1158
- my %ad = date_str($co{'author_epoch'});
1159
- if ($alternate) {
1160
- print "<tr class=\"dark\">\n";
1161
- } else {
1162
- print "<tr class=\"light\">\n";
1163
- }
1164
- $alternate ^= 1;
1165
- if ($i-- > 0) {
1166
- my $ref = git_get_referencing($refs, $commit);
1167
- print "<td><i>$co{'age_string'}</i></td>\n" .
1168
- "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
1169
- "<td>";
1170
- if (length($co{'title_short'}) < length($co{'title'})) {
1171
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
1172
- "<b>" . esc_html($co{'title_short'}) . "$ref</b>");
1173
- } else {
1174
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"},
1175
- "<b>" . esc_html($co{'title'}) . "$ref</b>");
1176
- }
1177
- print "</td>\n" .
1178
- "<td class=\"link\">" .
1179
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
1180
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
1181
- "</td>\n" .
1182
- "</tr>";
1183
- } else {
1184
- print "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "...") . "</td>\n" .
1185
- "</tr>";
1186
- last;
1187
- }
1188
- }
1189
- print "</table\n>";
1309
+ git_shortlog_body(\@revlist, 0, 15, $refs,
1310
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "..."));
1311
1312
my $taglist = git_read_refs("refs/tags");
1313
if (defined @$taglist) {
1314
git_header_div('tags');
1194
- my $i = 16;
1195
- print "<table cellspacing=\"0\">\n";
1196
- my $alternate = 0;
1197
- foreach my $entry (@$taglist) {
1198
- my %tag = %$entry;
1199
- my $comment_lines = $tag{'comment'};
1200
- my $comment = shift @$comment_lines;
1201
- if (defined($comment)) {
1202
- $comment = chop_str($comment, 30, 5);
1203
- }
1204
- if ($alternate) {
1205
- print "<tr class=\"dark\">\n";
1206
- } else {
1207
- print "<tr class=\"light\">\n";
1208
- }
1209
- $alternate ^= 1;
1210
- if ($i-- > 0) {
1211
- print "<td><i>$tag{'age'}</i></td>\n" .
1212
- "<td>" .
1213
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
1214
- "<b>" . esc_html($tag{'name'}) . "</b>") .
1215
- "</td>\n" .
1216
- "<td>";
1217
- if (defined($comment)) {
1218
- print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, esc_html($comment));
1219
- }
1220
- print "</td>\n" .
1221
- "<td class=\"link\">";
1222
- if ($tag{'type'} eq "tag") {
1223
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, "tag") . " | ";
1224
- }
1225
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1226
- if ($tag{'reftype'} eq "commit") {
1227
- print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1228
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log");
1229
- }
1230
- print "</td>\n" .
1231
- "</tr>";
1232
- } else {
1233
- print "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tags")}, "...") . "</td>\n" .
1234
- "</tr>";
1235
- last;
1236
- }
1237
- }
1238
- print "</table\n>";
1315
+ git_tags_body($taglist, 0, 15,
1316
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tags")}, "..."));
1317
}
1318
1319
my $headlist = git_read_refs("refs/heads");
1320
if (defined @$headlist) {
1321
git_header_div('heads');
1244
- my $i = 16;
1245
- print "<table cellspacing=\"0\">\n";
1246
- my $alternate = 0;
1247
- foreach my $entry (@$headlist) {
1248
- my %tag = %$entry;
1249
- if ($alternate) {
1250
- print "<tr class=\"dark\">\n";
1251
- } else {
1252
- print "<tr class=\"light\">\n";
1253
- }
1254
- $alternate ^= 1;
1255
- if ($i-- > 0) {
1256
- print "<td><i>$tag{'age'}</i></td>\n" .
1257
- "<td>" .
1258
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}"), -class => "list"},
1259
- "<b>" . esc_html($tag{'name'}) . "</b>") .
1260
- "</td>\n" .
1261
- "<td class=\"link\">" .
1262
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1263
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'name'}")}, "log") .
1264
- "</td>\n" .
1265
- "</tr>";
1266
- } else {
1267
- print "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=heads")}, "...") . "</td>\n" .
1268
- "</tr>";
1269
- last;
1270
- }
1271
- }
1272
- print "</table\n>";
1322
+ git_heads_body($taglist, $head, 0, 15,
1323
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=heads")}, "..."));
1324
}
1325
+
1326
git_footer_html();
1327
}
1328
1524
git_header_html();
1525
git_page_nav('','', $head,undef,$head);
1526
git_header_div('summary', $project);
1475
- print "<table cellspacing=\"0\">\n";
1527
1528
my $taglist = git_read_refs("refs/tags");
1478
- my $alternate = 0;
1529
if (defined @$taglist) {
1480
- foreach my $entry (@$taglist) {
1481
- my %tag = %$entry;
1482
- my $comment_lines = $tag{'comment'};
1483
- my $comment = shift @$comment_lines;
1484
- if (defined($comment)) {
1485
- $comment = chop_str($comment, 30, 5);
1486
- }
1487
- if ($alternate) {
1488
- print "<tr class=\"dark\">\n";
1489
- } else {
1490
- print "<tr class=\"light\">\n";
1491
- }
1492
- $alternate ^= 1;
1493
- print "<td><i>$tag{'age'}</i></td>\n" .
1494
- "<td>" .
1495
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}"), -class => "list"},
1496
- "<b>" . esc_html($tag{'name'}) . "</b>") .
1497
- "</td>\n" .
1498
- "<td>";
1499
- if (defined($comment)) {
1500
- print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
1501
- }
1502
- print "</td>\n" .
1503
- "<td class=\"link\">";
1504
- if ($tag{'type'} eq "tag") {
1505
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, "tag") . " | ";
1506
- }
1507
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$tag{'reftype'};h=$tag{'refid'}")}, $tag{'reftype'});
1508
- if ($tag{'reftype'} eq "commit") {
1509
- print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1510
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'refid'}")}, "log");
1511
- }
1512
- print "</td>\n" .
1513
- "</tr>";
1514
- }
1530
+ git_tags_body($taglist);
1531
}
1516
- print "</table\n>";
1532
git_footer_html();
1533
}
1534
1536
my $head = git_read_head($project);
1537
git_header_html();
1538
git_page_nav('','', $head,undef,$head);
1524
- hit_header_div('summary', $project);
1525
- print "<table cellspacing=\"0\">\n";
1539
+ git_header_div('summary', $project);
1540
1541
my $taglist = git_read_refs("refs/heads");
1542
my $alternate = 0;
1543
if (defined @$taglist) {
1530
- foreach my $entry (@$taglist) {
1531
- my %tag = %$entry;
1532
- if ($alternate) {
1533
- print "<tr class=\"dark\">\n";
1534
- } else {
1535
- print "<tr class=\"light\">\n";
1536
- }
1537
- $alternate ^= 1;
1538
- print "<td><i>$tag{'age'}</i></td>\n" .
1539
- "<td>" .
1540
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}"), -class => "list"}, "<b>" . esc_html($tag{'name'}) . "</b>") .
1541
- "</td>\n" .
1542
- "<td class=\"link\">" .
1543
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$tag{'name'}")}, "shortlog") .
1544
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$tag{'name'}")}, "log") .
1545
- "</td>\n" .
1546
- "</tr>";
1547
- }
1544
+ git_heads_body($taglist, $head);
1545
}
1549
- print "</table\n>";
1546
git_footer_html();
1547
}
1548
2540
close $fd;
2541
2542
my $paging_nav = git_get_paging_nav('shortlog', $hash, $head, $page, $#revlist);
2543
+ my $next_link = '';
2544
+ if ($#revlist >= (100 * ($page+1)-1)) {
2545
+ $next_link =
2546
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)),
2547
+ -title => "Alt-n"}, "next");
2548
+ }
2549
+
2550
2551
git_header_html();
2552
git_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);
2553
git_header_div('summary', $project);
2554
2552
- print "<table cellspacing=\"0\">\n";
2553
- my $alternate = 0;
2554
- for (my $i = ($page * 100); $i <= $#revlist; $i++) {
2555
- my $commit = $revlist[$i];
2556
- my $ref = git_get_referencing($refs, $commit);
2557
- my %co = git_read_commit($commit);
2558
- my %ad = date_str($co{'author_epoch'});
2559
- if ($alternate) {
2560
- print "<tr class=\"dark\">\n";
2561
- } else {
2562
- print "<tr class=\"light\">\n";
2563
- }
2564
- $alternate ^= 1;
2565
- print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" .
2566
- "<td><i>" . esc_html(chop_str($co{'author_name'}, 10)) . "</i></td>\n" .
2567
- "<td>";
2568
- if (length($co{'title_short'}) < length($co{'title'})) {
2569
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"},
2570
- "<b>" . esc_html($co{'title_short'}) . "$ref</b>");
2571
- } else {
2572
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"},
2573
- "<b>" . esc_html($co{'title_short'}) . "$ref</b>");
2574
- }
2575
- print "</td>\n" .
2576
- "<td class=\"link\">" .
2577
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
2578
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
2579
- "</td>\n" .
2580
- "</tr>";
2581
- }
2582
- if ($#revlist >= (100 * ($page+1)-1)) {
2583
- print "<tr>\n" .
2584
- "<td>" .
2585
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -title => "Alt-n"}, "next") .
2586
- "</td>\n" .
2587
- "</tr>\n";
2588
- }
2589
- print "</table\n>";
2555
+ git_shortlog_body(\@revlist, ($page * 100), $#revlist, $refs, $next_link);
2556
+
2557
git_footer_html();
2558
}