X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/9dda602ca3deaf9a78a90f4ba77008569ead5a4f..35d19bbb641aa56a21fb2c238994716c272e154f:/ui-commit.c diff --git a/ui-commit.c b/ui-commit.c index 4ac8955..dd36cc0 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,20 +65,20 @@ 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_diff_link(info->new_path, NULL, NULL, cgit_query_head, curr_rev, + 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)", @@ -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"); + html("\n"); html("\n"); for (p = commit->parents; p ; p = p->next) { parent = lookup_commit_reference(p->item->object.sha1); @@ -188,16 +197,16 @@ void cgit_print_commit(char *hex) html("" ""); } - if (cgit_repo->snapshots) { + if (ctx.repo->snapshots) { html(""); } html("
author"); html_txt(info->author); html(" "); @@ -172,10 +175,16 @@ void cgit_print_commit(char *hex) html(""); cgit_print_date(info->committer_date, FMT_LONGDATE); html("
commit"); + tmp = sha1_to_hex(commit->object.sha1); + cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); + html(" ("); + cgit_patch_link("patch", NULL, NULL, NULL, tmp); + 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, cgit_query_head, - hex, cgit_repo->snapshots); + cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, + hex, ctx.repo->snapshots); html("
\n"); @@ -209,17 +218,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);