X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/1d4aaff696ee1b9085dda0f0f3d84d9d20d96db0..89aa3c0d0a4c6d9885272602005975b763ea1604:/ui-commit.c?ds=sidebyside diff --git a/ui-commit.c b/ui-commit.c index 50e9e11..c2fafd7 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -7,6 +7,9 @@ */ #include "cgit.h" +#include "html.h" +#include "ui-shared.h" +#include "ui-diff.h" static int files, slots; static int total_adds, total_rems, max_changes; @@ -62,21 +65,21 @@ void print_fileinfo(struct fileinfo *info) html(""); htmlf(""); if (is_null_sha1(info->new_sha1)) { - html_filemode(info->old_mode); + cgit_print_filemode(info->old_mode); } else { - html_filemode(info->new_mode); + cgit_print_filemode(info->new_mode); } if (info->old_mode != info->new_mode && !is_null_sha1(info->old_sha1) && !is_null_sha1(info->new_sha1)) { html("["); - html_filemode(info->old_mode); + cgit_print_filemode(info->old_mode); html("]"); } htmlf("", class); - cgit_tree_link(info->new_path, NULL, NULL, cgit_query_head, curr_rev, - info->new_path); + cgit_diff_link(info->new_path, NULL, NULL, ctx.qry.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", @@ -84,7 +87,7 @@ void print_fileinfo(struct fileinfo *info) html(""); htmlf("%d", info->added + info->removed); html(""); - htmlf("", (max_changes > 100 ? 100 : max_changes)); + htmlf("
", (max_changes > 100 ? 100 : max_changes)); htmlf("
", info->added * 100.0 / max_changes); htmlf("", @@ -143,7 +146,7 @@ void cgit_print_commit(char *hex) int i; if (!hex) - hex = cgit_query_head; + hex = ctx.qry.head; curr_rev = hex; if (get_sha1(hex, sha1)) { @@ -157,7 +160,7 @@ void cgit_print_commit(char *hex) } info = cgit_parse_commit(commit); - html("\n"); + html("
\n"); html("\n"); for (p = commit->parents; p ; p = p->next) { parent = lookup_commit_reference(p->item->object.sha1); @@ -188,15 +191,16 @@ void cgit_print_commit(char *hex) html("" ""); } - if (cgit_repo->snapshots) { + if (ctx.repo->snapshots) { html(""); } html("
author"); html_txt(info->author); html(" "); @@ -175,7 +178,7 @@ void cgit_print_commit(char *hex) html("
tree"); tmp = xstrdup(hex); cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, - cgit_query_head, tmp, NULL); + ctx.qry.head, tmp, NULL); html("
parent"); cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, - cgit_query_head, sha1_to_hex(p->item->object.sha1)); + ctx.qry.head, sha1_to_hex(p->item->object.sha1)); html(" ("); - cgit_diff_link("diff", NULL, NULL, cgit_query_head, hex, + cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, sha1_to_hex(p->item->object.sha1), NULL); html(")
download"); - cgit_print_snapshot_links(cgit_query_repo,hex,cgit_repo->snapshots); + cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, + hex, ctx.repo->snapshots); html("
\n"); @@ -208,17 +212,18 @@ void cgit_print_commit(char *hex) html(""); if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { html("
Diffstat
"); - html(""); + html("
"); max_changes = 0; cgit_diff_commit(commit, inspect_filepair); for(i = 0; i"); html("
"); - htmlf("%d files changed, %d insertions, %d deletions (", + 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); + cgit_print_diff(ctx.qry.sha1, + sha1_to_hex(commit->parents->item->object.sha1), + NULL); html(")
"); } cgit_free_commitinfo(info);