summaryrefslogtreecommitdiffabout
path: root/ui-log.c
Unidiff
Diffstat (limited to 'ui-log.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-log.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ui-log.c b/ui-log.c
index e5f3c57..a41d2b2 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -45,96 +45,96 @@ void print_commit(struct commit *commit)
45 rem_lines = 0; 45 rem_lines = 0;
46 cgit_diff_commit(commit, inspect_files); 46 cgit_diff_commit(commit, inspect_files);
47 html("</td><td class='right'>"); 47 html("</td><td class='right'>");
48 htmlf("%d", files); 48 htmlf("%d", files);
49 if (cgit_repo->enable_log_linecount) { 49 if (cgit_repo->enable_log_linecount) {
50 html("</td><td class='right'>"); 50 html("</td><td class='right'>");
51 htmlf("-%d/+%d", rem_lines, add_lines); 51 htmlf("-%d/+%d", rem_lines, add_lines);
52 } 52 }
53 } 53 }
54 html("</td><td>"); 54 html("</td><td>");
55 html_txt(info->author); 55 html_txt(info->author);
56 html("</td></tr>\n"); 56 html("</td></tr>\n");
57 cgit_free_commitinfo(info); 57 cgit_free_commitinfo(info);
58} 58}
59 59
60 60
61void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager) 61void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, char *path, int pager)
62{ 62{
63 struct rev_info rev; 63 struct rev_info rev;
64 struct commit *commit; 64 struct commit *commit;
65 const char *argv[] = {NULL, tip, NULL, NULL, NULL}; 65 const char *argv[] = {NULL, tip, NULL, NULL, NULL};
66 int argc = 2; 66 int argc = 2;
67 int i; 67 int i;
68 68
69 if (!tip) 69 if (!tip)
70 argv[1] = cgit_query_head; 70 argv[1] = cgit_query_head;
71 71
72 if (grep && pattern && (!strcmp(grep, "grep") || 72 if (grep && pattern && (!strcmp(grep, "grep") ||
73 !strcmp(grep, "author") || 73 !strcmp(grep, "author") ||
74 !strcmp(grep, "committer"))) 74 !strcmp(grep, "committer")))
75 argv[argc++] = fmt("--%s=%s", grep, pattern); 75 argv[argc++] = fmt("--%s=%s", grep, pattern);
76 76
77 if (path) { 77 if (path) {
78 argv[argc++] = "--"; 78 argv[argc++] = "--";
79 argv[argc++] = path; 79 argv[argc++] = path;
80 } 80 }
81 init_revisions(&rev, NULL); 81 init_revisions(&rev, NULL);
82 rev.abbrev = DEFAULT_ABBREV; 82 rev.abbrev = DEFAULT_ABBREV;
83 rev.commit_format = CMIT_FMT_DEFAULT; 83 rev.commit_format = CMIT_FMT_DEFAULT;
84 rev.verbose_header = 1; 84 rev.verbose_header = 1;
85 rev.show_root_diff = 0; 85 rev.show_root_diff = 0;
86 setup_revisions(argc, argv, &rev, NULL); 86 setup_revisions(argc, argv, &rev, NULL);
87 if (rev.grep_filter) { 87 if (rev.grep_filter) {
88 rev.grep_filter->regflags |= REG_ICASE; 88 rev.grep_filter->regflags |= REG_ICASE;
89 compile_grep_patterns(rev.grep_filter); 89 compile_grep_patterns(rev.grep_filter);
90 } 90 }
91 prepare_revision_walk(&rev); 91 prepare_revision_walk(&rev);
92 92
93 html("<table class='list nowrap'>"); 93 html("<table summary='log' class='list nowrap'>");
94 html("<tr class='nohover'><th class='left'>Age</th>" 94 html("<tr class='nohover'><th class='left'>Age</th>"
95 "<th class='left'>Message</th>"); 95 "<th class='left'>Message</th>");
96 96
97 if (cgit_repo->enable_log_filecount) { 97 if (cgit_repo->enable_log_filecount) {
98 html("<th class='right'>Files</th>"); 98 html("<th class='right'>Files</th>");
99 if (cgit_repo->enable_log_linecount) 99 if (cgit_repo->enable_log_linecount)
100 html("<th class='right'>Lines</th>"); 100 html("<th class='right'>Lines</th>");
101 } 101 }
102 html("<th class='left'>Author</th></tr>\n"); 102 html("<th class='left'>Author</th></tr>\n");
103 103
104 if (ofs<0) 104 if (ofs<0)
105 ofs = 0; 105 ofs = 0;
106 106
107 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) { 107 for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; i++) {
108 free(commit->buffer); 108 free(commit->buffer);
109 commit->buffer = NULL; 109 commit->buffer = NULL;
110 free_commit_list(commit->parents); 110 free_commit_list(commit->parents);
111 commit->parents = NULL; 111 commit->parents = NULL;
112 } 112 }
113 113
114 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { 114 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) {
115 print_commit(commit); 115 print_commit(commit);
116 free(commit->buffer); 116 free(commit->buffer);
117 commit->buffer = NULL; 117 commit->buffer = NULL;
118 free_commit_list(commit->parents); 118 free_commit_list(commit->parents);
119 commit->parents = NULL; 119 commit->parents = NULL;
120 } 120 }
121 html("</table>\n"); 121 html("</table>\n");
122 122
123 if (pager) { 123 if (pager) {
124 html("<div class='pager'>"); 124 html("<div class='pager'>");
125 if (ofs > 0) { 125 if (ofs > 0) {
126 cgit_log_link("[prev]", NULL, NULL, cgit_query_head, 126 cgit_log_link("[prev]", NULL, NULL, cgit_query_head,
127 cgit_query_sha1, cgit_query_path, 127 cgit_query_sha1, cgit_query_path,
128 ofs - cnt, cgit_query_grep, 128 ofs - cnt, cgit_query_grep,
129 cgit_query_search); 129 cgit_query_search);
130 html("&nbsp;"); 130 html("&nbsp;");
131 } 131 }
132 if ((commit = get_revision(&rev)) != NULL) { 132 if ((commit = get_revision(&rev)) != NULL) {
133 cgit_log_link("[next]", NULL, NULL, cgit_query_head, 133 cgit_log_link("[next]", NULL, NULL, cgit_query_head,
134 cgit_query_sha1, cgit_query_path, 134 cgit_query_sha1, cgit_query_path,
135 ofs + cnt, cgit_query_grep, 135 ofs + cnt, cgit_query_grep,
136 cgit_query_search); 136 cgit_query_search);
137 } 137 }
138 html("</div>"); 138 html("</div>");
139 } 139 }
140} 140}