X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/e189344a7dfe6fa1b07434d5170e6441dcbaf788..0274b57d55a12ed38259757dbfae96b79cfa2e0b:/ui-log.c
diff --git a/ui-log.c b/ui-log.c
index 4237921..631e46d 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -7,67 +7,96 @@
*/
#include "cgit.h"
+#include "html.h"
+#include "ui-shared.h"
-int files, lines;
+int files, add_lines, rem_lines;
void count_lines(char *line, int size)
{
- if (size>0 && (line[0] == '+' || line[0] == '-'))
- lines++;
+ if (size <= 0)
+ return;
+
+ if (line[0] == '+')
+ add_lines++;
+
+ else if (line[0] == '-')
+ rem_lines++;
}
void inspect_files(struct diff_filepair *pair)
{
files++;
- if (cgit_repo->enable_log_linecount)
+ if (ctx.repo->enable_log_linecount)
cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines);
}
void print_commit(struct commit *commit)
{
- char buf[32];
struct commitinfo *info;
- struct tm *time;
+ char *tmp;
info = cgit_parse_commit(commit);
- time = gmtime(&commit->date);
html("
| ");
- strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", time);
- html_txt(buf);
- html(" | ");
- char *qry = fmt("h=%s", sha1_to_hex(commit->object.sha1));
- char *url = cgit_pageurl(cgit_query_repo, "commit", qry);
- html_link_open(url, NULL, NULL);
- html_ntxt(cgit_max_msg_len, info->subject);
+ tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
+ tmp = cgit_pageurl(ctx.repo->url, "commit", tmp);
+ html_link_open(tmp, NULL, NULL);
+ cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
html_link_close();
- if (cgit_repo->enable_log_filecount) {
+ html(" | ");
+ if (ctx.qry.showmsg)
+ html("");
+ cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
+ sha1_to_hex(commit->object.sha1));
+ if (ctx.qry.showmsg)
+ html("");
+ html(" | ");
+ html_txt(info->author);
+ if (ctx.repo->enable_log_filecount) {
files = 0;
- lines = 0;
+ add_lines = 0;
+ rem_lines = 0;
cgit_diff_commit(commit, inspect_files);
- html(" | ");
+ html(" | ");
htmlf("%d", files);
- if (cgit_repo->enable_log_linecount) {
- html(" | ");
- htmlf("%d", lines);
+ if (ctx.repo->enable_log_linecount) {
+ html(" | ");
+ htmlf("-%d/+%d", rem_lines, add_lines);
}
}
- html(" | ");
- html_txt(info->author);
html(" |
\n");
+ if (ctx.qry.showmsg) {
+ html("| ");
+ cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0,
+ NULL, NULL, ctx.qry.showmsg);
+ html(" |
\n");
}
- html("");
}