X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/9927e63f387e6c9328eb3c347ecb0e339f8ac023..c83db796a1cf6893de275e78b98cef10eccc1200:/ui-commit.c
diff --git a/ui-commit.c b/ui-commit.c
index b6a106f..1d12bbb 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -29,7 +29,6 @@ void print_fileinfo(struct fileinfo *info)
{
char *query, *query2;
char *class;
- double width;
switch (info->status) {
case DIFF_STATUS_ADDED:
@@ -76,7 +75,7 @@ void print_fileinfo(struct fileinfo *info)
html("]");
}
htmlf("
", class);
- query = fmt("id=%s&id2=%s&path=%s", sha1_to_hex(info->old_sha1),
+ query = fmt("id=%s&id2=%s&path=%s", sha1_to_hex(info->old_sha1),
sha1_to_hex(info->new_sha1), info->new_path);
html_link_open(cgit_pageurl(cgit_query_repo, "diff", query),
NULL, NULL);
@@ -96,18 +95,15 @@ void print_fileinfo(struct fileinfo *info)
}
html(" | ");
htmlf("%d", info->added + info->removed);
-
html(" | ");
- width = (info->added + info->removed) * 100.0 / max_changes;
- if (width < 0.1)
- width = 0.1;
- html_link_open(cgit_pageurl(cgit_query_repo, "diff", query),
- NULL, NULL);
- htmlf(" ",
- info->added * width / (info->added + info->removed));
- htmlf(" ",
- info->removed * width / (info->added + info->removed));
- html(" | \n");
+ htmlf("", (max_changes > 100 ? 100 : max_changes));
+ htmlf(" | ",
+ info->added * 100.0 / max_changes);
+ htmlf(" | ",
+ info->removed * 100.0 / max_changes);
+ htmlf(" | ",
+ (max_changes - info->removed - info->added) * 100.0 / max_changes);
+ html("
\n");
}
void cgit_count_diff_lines(char *line, int len)
@@ -176,17 +172,17 @@ void cgit_print_commit(const char *hex)
html(" ");
html_txt(info->author_email);
html("");
- cgit_print_date(info->author_date);
+ cgit_print_date(info->author_date, FMT_LONGDATE);
html(" | \n");
html("| committer | ");
html_txt(info->committer);
html(" ");
html_txt(info->committer_email);
html(" | ");
- cgit_print_date(info->committer_date);
+ cgit_print_date(info->committer_date, FMT_LONGDATE);
html(" |
\n");
html("| tree | %s |
\n", sha1_to_hex(commit->tree->object.sha1));
@@ -201,11 +197,11 @@ void cgit_print_commit(const char *hex)
html("| parent | "
""
"%s (diff) |
");
@@ -214,7 +210,7 @@ void cgit_print_commit(const char *hex)
htmlf("| download | %s |
", filename);
}
html("\n");
@@ -225,6 +221,7 @@ void cgit_print_commit(const char *hex)
html_txt(info->msg);
html("");
if (!(commit->parents && commit->parents->next && commit->parents->next->next)) {
+ html("");
html("");
max_changes = 0;
cgit_diff_commit(commit, inspect_filepair);
@@ -232,8 +229,11 @@ void cgit_print_commit(const char *hex)
print_fileinfo(&items[i]);
html("
");
html("");
- htmlf("%d files changed, %d insertions, %d deletions\n",
+ htmlf("%d files changed, %d insertions, %d deletions (",
files, total_adds, total_rems);
+ query = fmt("h=%s", hex);
+ html_link_open(cgit_pageurl(cgit_query_repo, "diff", query), NULL, NULL);
+ html("show diff)");
html("
");
}
cgit_free_commitinfo(info);