summaryrefslogtreecommitdiffabout
path: root/ui-commit.c
authorLars Hjemli <hjemli@gmail.com>2007-11-11 12:04:28 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-11-11 12:04:28 (UTC)
commit2915483ef6c9c29ac1493e6945688bb62f7825b4 (patch) (side-by-side diff)
tree3ee4afec27ec8cb0ad5e10008f3bd8c994747c39 /ui-commit.c
parentb4649fc90597910c89c3f37a6aec9af54d9f416b (diff)
downloadcgit-2915483ef6c9c29ac1493e6945688bb62f7825b4.zip
cgit-2915483ef6c9c29ac1493e6945688bb62f7825b4.tar.gz
cgit-2915483ef6c9c29ac1493e6945688bb62f7825b4.tar.bz2
Fix html error detected by test-suite
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-commit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-commit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui-commit.c b/ui-commit.c
index 4ac8955..bd55a33 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -63,49 +63,49 @@ void print_fileinfo(struct fileinfo *info)
htmlf("<td class='mode'>");
if (is_null_sha1(info->new_sha1)) {
html_filemode(info->old_mode);
} else {
html_filemode(info->new_mode);
}
if (info->old_mode != info->new_mode &&
!is_null_sha1(info->old_sha1) &&
!is_null_sha1(info->new_sha1)) {
html("<span class='modechange'>[");
html_filemode(info->old_mode);
html("]</span>");
}
htmlf("</td><td class='%s'>", class);
cgit_diff_link(info->new_path, NULL, NULL, cgit_query_head, curr_rev,
NULL, info->new_path);
if (info->status == DIFF_STATUS_COPIED || info->status == DIFF_STATUS_RENAMED)
htmlf(" (%s from %s)",
info->status == DIFF_STATUS_COPIED ? "copied" : "renamed",
info->old_path);
html("</td><td class='right'>");
htmlf("%d", info->added + info->removed);
html("</td><td class='graph'>");
- htmlf("<table width='%d%%'><tr>", (max_changes > 100 ? 100 : max_changes));
+ htmlf("<table summary='file diffstat' width='%d%%'><tr>", (max_changes > 100 ? 100 : max_changes));
htmlf("<td class='add' style='width: %.1f%%;'/>",
info->added * 100.0 / max_changes);
htmlf("<td class='rem' style='width: %.1f%%;'/>",
info->removed * 100.0 / max_changes);
htmlf("<td class='none' style='width: %.1f%%;'/>",
(max_changes - info->removed - info->added) * 100.0 / max_changes);
html("</tr></table></td></tr>\n");
}
void cgit_count_diff_lines(char *line, int len)
{
if (line && (len > 0)) {
if (line[0] == '+')
lines_added++;
else if (line[0] == '-')
lines_removed++;
}
}
void inspect_filepair(struct diff_filepair *pair)
{
files++;
lines_added = 0;
lines_removed = 0;
@@ -136,49 +136,49 @@ void inspect_filepair(struct diff_filepair *pair)
void cgit_print_commit(char *hex)
{
struct commit *commit, *parent;
struct commitinfo *info;
struct commit_list *p;
unsigned char sha1[20];
char *tmp;
int i;
if (!hex)
hex = cgit_query_head;
curr_rev = hex;
if (get_sha1(hex, sha1)) {
cgit_print_error(fmt("Bad object id: %s", hex));
return;
}
commit = lookup_commit_reference(sha1);
if (!commit) {
cgit_print_error(fmt("Bad commit reference: %s", hex));
return;
}
info = cgit_parse_commit(commit);
- html("<table class='commit-info'>\n");
+ html("<table summary='commit info' class='commit-info'>\n");
html("<tr><th>author</th><td>");
html_txt(info->author);
html(" ");
html_txt(info->author_email);
html("</td><td class='right'>");
cgit_print_date(info->author_date, FMT_LONGDATE);
html("</td></tr>\n");
html("<tr><th>committer</th><td>");
html_txt(info->committer);
html(" ");
html_txt(info->committer_email);
html("</td><td class='right'>");
cgit_print_date(info->committer_date, FMT_LONGDATE);
html("</td></tr>\n");
html("<tr><th>tree</th><td colspan='2' class='sha1'>");
tmp = xstrdup(hex);
cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL,
cgit_query_head, tmp, NULL);
html("</td></tr>\n");
for (p = commit->parents; p ; p = p->next) {
parent = lookup_commit_reference(p->item->object.sha1);
if (!parent) {
html("<tr><td colspan='3'>");
cgit_print_error("Error reading parent commit");
@@ -188,39 +188,39 @@ void cgit_print_commit(char *hex)
html("<tr><th>parent</th>"
"<td colspan='2' class='sha1'>");
cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL,
cgit_query_head, sha1_to_hex(p->item->object.sha1));
html(" (");
cgit_diff_link("diff", NULL, NULL, cgit_query_head, hex,
sha1_to_hex(p->item->object.sha1), NULL);
html(")</td></tr>");
}
if (cgit_repo->snapshots) {
html("<tr><th>download</th><td colspan='2' class='sha1'>");
cgit_print_snapshot_links(cgit_query_repo, cgit_query_head,
hex, cgit_repo->snapshots);
html("</td></tr>");
}
html("</table>\n");
html("<div class='commit-subject'>");
html_txt(info->subject);
html("</div>");
html("<div class='commit-msg'>");
html_txt(info->msg);
html("</div>");
if (!(commit->parents && commit->parents->next && commit->parents->next->next)) {
html("<div class='diffstat-header'>Diffstat</div>");
- html("<table class='diffstat'>");
+ html("<table summary='diffstat' class='diffstat'>");
max_changes = 0;
cgit_diff_commit(commit, inspect_filepair);
for(i = 0; i<files; i++)
print_fileinfo(&items[i]);
html("</table>");
html("<div class='diffstat-summary'>");
htmlf("%d files changed, %d insertions, %d deletions (",
files, total_adds, total_rems);
cgit_diff_link("show diff", NULL, NULL, cgit_query_head, hex,
NULL, NULL);
html(")</div>");
}
cgit_free_commitinfo(info);
}