X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/4a0be586662843382ecfa53af34a13b291312bc0..2ee1238cdff66dcd4bf98f83b820678976f53ed8:/ui-commit.c
diff --git a/ui-commit.c b/ui-commit.c
index 2679b59..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,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(" | ",
@@ -139,12 +142,11 @@ void cgit_print_commit(char *hex)
struct commitinfo *info;
struct commit_list *p;
unsigned char sha1[20];
- char *filename;
char *tmp;
int i;
if (!hex)
- hex = cgit_query_head;
+ hex = ctx.qry.head;
curr_rev = hex;
if (get_sha1(hex, sha1)) {
@@ -158,7 +160,7 @@ void cgit_print_commit(char *hex)
}
info = cgit_parse_commit(commit);
- html("\n");
+ html("\n");
html("| author | ");
html_txt(info->author);
html(" ");
@@ -173,10 +175,16 @@ void cgit_print_commit(char *hex)
html(" | ");
cgit_print_date(info->committer_date, FMT_LONGDATE);
html(" | \n");
+ 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(") | \n");
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(" | \n");
for (p = commit->parents; p ; p = p->next) {
parent = lookup_commit_reference(p->item->object.sha1);
@@ -189,18 +197,17 @@ void cgit_print_commit(char *hex)
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(") | ");
}
- if (cgit_repo->snapshots) {
- htmlf("| download | %s | ", filename);
+ if (ctx.repo->snapshots) {
+ html("| download | ");
+ cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head,
+ hex, ctx.repo->snapshots);
+ html(" | ");
}
html(" \n");
html("");
@@ -211,17 +218,18 @@ void cgit_print_commit(char *hex)
html(" ");
if (!(commit->parents && commit->parents->next && commit->parents->next->next)) {
html("");
- 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);
|