summaryrefslogtreecommitdiffabout
path: root/ui-log.c
Unidiff
Diffstat (limited to 'ui-log.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-log.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui-log.c b/ui-log.c
index 7d1985e..6d5509b 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -32,58 +32,62 @@ void print_commit(struct commit *commit)
32 time = gmtime(&commit->date); 32 time = gmtime(&commit->date);
33 html("<tr><td>"); 33 html("<tr><td>");
34 strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", time); 34 strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", time);
35 html_txt(buf); 35 html_txt(buf);
36 html("</td><td>"); 36 html("</td><td>");
37 char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1)); 37 char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1));
38 char *url = cgit_pageurl(cgit_query_repo, "commit", qry); 38 char *url = cgit_pageurl(cgit_query_repo, "commit", qry);
39 html_link_open(url, NULL, NULL); 39 html_link_open(url, NULL, NULL);
40 html_ntxt(cgit_max_msg_len, info->subject); 40 html_ntxt(cgit_max_msg_len, info->subject);
41 html_link_close(); 41 html_link_close();
42 files = 0; 42 files = 0;
43 lines = 0; 43 lines = 0;
44 cgit_diff_commit(commit, inspect_files); 44 cgit_diff_commit(commit, inspect_files);
45 html("</td><td class='right'>"); 45 html("</td><td class='right'>");
46 htmlf("%d", files); 46 htmlf("%d", files);
47 html("</td><td class='right'>"); 47 html("</td><td class='right'>");
48 htmlf("%d", lines); 48 htmlf("%d", lines);
49 html("</td><td>"); 49 html("</td><td>");
50 html_txt(info->author); 50 html_txt(info->author);
51 html("</td></tr>\n"); 51 html("</td></tr>\n");
52 cgit_free_commitinfo(info); 52 cgit_free_commitinfo(info);
53} 53}
54 54
55 55
56void cgit_print_log(const char *tip, int ofs, int cnt, char *grep) 56void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path)
57{ 57{
58 struct rev_info rev; 58 struct rev_info rev;
59 struct commit *commit; 59 struct commit *commit;
60 const char *argv[3] = {NULL, tip, NULL}; 60 const char *argv[] = {NULL, tip, NULL, NULL, NULL};
61 int argc = 2; 61 int argc = 2;
62 int i; 62 int i;
63 63
64 if (grep) 64 if (grep)
65 argv[argc++] = fmt("--grep=%s", grep); 65 argv[argc++] = fmt("--grep=%s", grep);
66 if (path) {
67 argv[argc++] = "--";
68 argv[argc++] = path;
69 }
66 init_revisions(&rev, NULL); 70 init_revisions(&rev, NULL);
67 rev.abbrev = DEFAULT_ABBREV; 71 rev.abbrev = DEFAULT_ABBREV;
68 rev.commit_format = CMIT_FMT_DEFAULT; 72 rev.commit_format = CMIT_FMT_DEFAULT;
69 rev.verbose_header = 1; 73 rev.verbose_header = 1;
70 rev.show_root_diff = 0; 74 rev.show_root_diff = 0;
71 setup_revisions(argc, argv, &rev, NULL); 75 setup_revisions(argc, argv, &rev, NULL);
72 if (rev.grep_filter) { 76 if (rev.grep_filter) {
73 rev.grep_filter->regflags |= REG_ICASE; 77 rev.grep_filter->regflags |= REG_ICASE;
74 compile_grep_patterns(rev.grep_filter); 78 compile_grep_patterns(rev.grep_filter);
75 } 79 }
76 prepare_revision_walk(&rev); 80 prepare_revision_walk(&rev);
77 81
78 html("<table class='list nowrap'>"); 82 html("<table class='list nowrap'>");
79 html("<tr class='nohover'><th class='left'>Date</th>" 83 html("<tr class='nohover'><th class='left'>Date</th>"
80 "<th class='left'>Message</th>" 84 "<th class='left'>Message</th>"
81 "<th class='left'>Files</th>" 85 "<th class='left'>Files</th>"
82 "<th class='left'>Lines</th>" 86 "<th class='left'>Lines</th>"
83 "<th class='left'>Author</th></tr>\n"); 87 "<th class='left'>Author</th></tr>\n");
84 88
85 if (ofs<0) 89 if (ofs<0)
86 ofs = 0; 90 ofs = 0;
87 91
88 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { 92 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) {
89 free(commit->buffer); 93 free(commit->buffer);