summaryrefslogtreecommitdiffabout
path: root/ui-log.c
Unidiff
Diffstat (limited to 'ui-log.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-log.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ui-log.c b/ui-log.c
index 9b2ffb6..746f40b 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -5,68 +5,73 @@
5 * Licensed under GNU General Public License v2 5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text) 6 * (see COPYING for full license text)
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10#include "html.h" 10#include "html.h"
11#include "ui-shared.h" 11#include "ui-shared.h"
12 12
13int files, add_lines, rem_lines; 13int files, add_lines, rem_lines;
14 14
15void count_lines(char *line, int size) 15void count_lines(char *line, int size)
16{ 16{
17 if (size <= 0) 17 if (size <= 0)
18 return; 18 return;
19 19
20 if (line[0] == '+') 20 if (line[0] == '+')
21 add_lines++; 21 add_lines++;
22 22
23 else if (line[0] == '-') 23 else if (line[0] == '-')
24 rem_lines++; 24 rem_lines++;
25} 25}
26 26
27void inspect_files(struct diff_filepair *pair) 27void inspect_files(struct diff_filepair *pair)
28{ 28{
29 files++; 29 files++;
30 if (ctx.repo->enable_log_linecount) 30 if (ctx.repo->enable_log_linecount)
31 cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); 31 cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines);
32} 32}
33 33
34void print_commit(struct commit *commit) 34void print_commit(struct commit *commit)
35{ 35{
36 struct commitinfo *info; 36 struct commitinfo *info;
37 char *tmp;
37 38
38 info = cgit_parse_commit(commit); 39 info = cgit_parse_commit(commit);
39 html("<tr><td>"); 40 html("<tr><td>");
41 tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
42 tmp = cgit_pageurl(ctx.repo->url, "commit", tmp);
43 html_link_open(tmp, NULL, NULL);
40 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); 44 cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
45 html_link_close();
41 html("</td><td>"); 46 html("</td><td>");
42 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, 47 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
43 sha1_to_hex(commit->object.sha1)); 48 sha1_to_hex(commit->object.sha1));
44 html("</td><td>"); 49 html("</td><td>");
45 html_txt(info->author); 50 html_txt(info->author);
46 if (ctx.repo->enable_log_filecount) { 51 if (ctx.repo->enable_log_filecount) {
47 files = 0; 52 files = 0;
48 add_lines = 0; 53 add_lines = 0;
49 rem_lines = 0; 54 rem_lines = 0;
50 cgit_diff_commit(commit, inspect_files); 55 cgit_diff_commit(commit, inspect_files);
51 html("</td><td>"); 56 html("</td><td>");
52 htmlf("%d", files); 57 htmlf("%d", files);
53 if (ctx.repo->enable_log_linecount) { 58 if (ctx.repo->enable_log_linecount) {
54 html("</td><td>"); 59 html("</td><td>");
55 htmlf("-%d/+%d", rem_lines, add_lines); 60 htmlf("-%d/+%d", rem_lines, add_lines);
56 } 61 }
57 } 62 }
58 html("</td></tr>\n"); 63 html("</td></tr>\n");
59 cgit_free_commitinfo(info); 64 cgit_free_commitinfo(info);
60} 65}
61 66
62 67
63void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, 68void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern,
64 char *path, int pager) 69 char *path, int pager)
65{ 70{
66 struct rev_info rev; 71 struct rev_info rev;
67 struct commit *commit; 72 struct commit *commit;
68 const char *argv[] = {NULL, tip, NULL, NULL, NULL}; 73 const char *argv[] = {NULL, tip, NULL, NULL, NULL};
69 int argc = 2; 74 int argc = 2;
70 int i, columns = 3; 75 int i, columns = 3;
71 76
72 if (!tip) 77 if (!tip)