summaryrefslogtreecommitdiffabout
path: root/ui-log.c
Side-by-side diff
Diffstat (limited to 'ui-log.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-log.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ui-log.c b/ui-log.c
index 72e2a4b..e1d324d 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -1,57 +1,58 @@
/* ui-log.c: functions for log output
*
* Copyright (C) 2006 Lars Hjemli
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
*/
#include "cgit.h"
+#include "html.h"
int files, add_lines, rem_lines;
void count_lines(char *line, int size)
{
if (size <= 0)
return;
if (line[0] == '+')
add_lines++;
else if (line[0] == '-')
rem_lines++;
}
void inspect_files(struct diff_filepair *pair)
{
files++;
if (ctx.repo->enable_log_linecount)
cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines);
}
void print_commit(struct commit *commit)
{
struct commitinfo *info;
info = cgit_parse_commit(commit);
html("<tr><td>");
cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
html("</td><td>");
cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
sha1_to_hex(commit->object.sha1));
if (ctx.repo->enable_log_filecount) {
files = 0;
add_lines = 0;
rem_lines = 0;
cgit_diff_commit(commit, inspect_files);
html("</td><td class='right'>");
htmlf("%d", files);
if (ctx.repo->enable_log_linecount) {
html("</td><td class='right'>");
htmlf("-%d/+%d", rem_lines, add_lines);
}
}
html("</td><td>");
html_txt(info->author);
html("</td></tr>\n");
cgit_free_commitinfo(info);