summaryrefslogtreecommitdiffabout
authorOndrej Jirman <ondrej.jirman@zonio.net>2007-05-26 01:26:14 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-31 08:24:37 (UTC)
commita922615dae5d1f7b932dd1fc5a5f121748d96c5a (patch) (unidiff)
tree05fec55980234a64658f6612499212f923206d29
parent3ce6fc16ef4670c535c6e35d48c7f980ff8a5532 (diff)
downloadcgit-a922615dae5d1f7b932dd1fc5a5f121748d96c5a.zip
cgit-a922615dae5d1f7b932dd1fc5a5f121748d96c5a.tar.gz
cgit-a922615dae5d1f7b932dd1fc5a5f121748d96c5a.tar.bz2
Add option to disable pager to cgit_print_log().
This is needed for upcomming shortlog on summary page patch. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h2
-rw-r--r--ui-log.c32
3 files changed, 19 insertions, 17 deletions
diff --git a/cgit.c b/cgit.c
index e5d8fbd..34e590e 100644
--- a/cgit.c
+++ b/cgit.c
@@ -85,25 +85,25 @@ static void cgit_print_repo_page(struct cacheitem *item)
85 cgit_print_pageheader("summary", show_search); 85 cgit_print_pageheader("summary", show_search);
86 cgit_print_summary(); 86 cgit_print_summary();
87 cgit_print_docend(); 87 cgit_print_docend();
88 return; 88 return;
89 } 89 }
90 90
91 cgit_print_pageheader(cgit_query_page, show_search); 91 cgit_print_pageheader(cgit_query_page, show_search);
92 92
93 switch(cgit_cmd) { 93 switch(cgit_cmd) {
94 case CMD_LOG: 94 case CMD_LOG:
95 cgit_print_log(cgit_query_head, cgit_query_ofs, 95 cgit_print_log(cgit_query_head, cgit_query_ofs,
96 cgit_max_commit_count, cgit_query_search, 96 cgit_max_commit_count, cgit_query_search,
97 cgit_query_path); 97 cgit_query_path, 1);
98 break; 98 break;
99 case CMD_TREE: 99 case CMD_TREE:
100 cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path); 100 cgit_print_tree(cgit_query_head, cgit_query_sha1, cgit_query_path);
101 break; 101 break;
102 case CMD_COMMIT: 102 case CMD_COMMIT:
103 cgit_print_commit(cgit_query_head); 103 cgit_print_commit(cgit_query_head);
104 break; 104 break;
105 case CMD_VIEW: 105 case CMD_VIEW:
106 cgit_print_view(cgit_query_sha1, cgit_query_path); 106 cgit_print_view(cgit_query_sha1, cgit_query_path);
107 break; 107 break;
108 case CMD_DIFF: 108 case CMD_DIFF:
109 cgit_print_diff(cgit_query_head, cgit_query_sha1, cgit_query_sha2, 109 cgit_print_diff(cgit_query_head, cgit_query_sha1, cgit_query_sha2,
diff --git a/cgit.h b/cgit.h
index 5c55bec..d6bcde2 100644
--- a/cgit.h
+++ b/cgit.h
@@ -204,24 +204,24 @@ extern char *cgit_pageurl(const char *reponame, const char *pagename,
204extern void cgit_print_error(char *msg); 204extern void cgit_print_error(char *msg);
205extern void cgit_print_date(time_t secs, char *format); 205extern void cgit_print_date(time_t secs, char *format);
206extern void cgit_print_age(time_t t, time_t max_relative, char *format); 206extern void cgit_print_age(time_t t, time_t max_relative, char *format);
207extern void cgit_print_docstart(char *title, struct cacheitem *item); 207extern void cgit_print_docstart(char *title, struct cacheitem *item);
208extern void cgit_print_docend(); 208extern void cgit_print_docend();
209extern void cgit_print_pageheader(char *title, int show_search); 209extern void cgit_print_pageheader(char *title, int show_search);
210extern void cgit_print_snapshot_start(const char *mimetype, 210extern void cgit_print_snapshot_start(const char *mimetype,
211 const char *filename, 211 const char *filename,
212 struct cacheitem *item); 212 struct cacheitem *item);
213 213
214extern void cgit_print_repolist(struct cacheitem *item); 214extern void cgit_print_repolist(struct cacheitem *item);
215extern void cgit_print_summary(); 215extern void cgit_print_summary();
216extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path); 216extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager);
217extern void cgit_print_view(const char *hex, char *path); 217extern void cgit_print_view(const char *hex, char *path);
218extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); 218extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
219extern void cgit_print_tree(const char *rev, const char *hex, char *path); 219extern void cgit_print_tree(const char *rev, const char *hex, char *path);
220extern void cgit_print_commit(const char *hex); 220extern void cgit_print_commit(const char *hex);
221extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, 221extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex,
222 char *path); 222 char *path);
223extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, 223extern void cgit_print_snapshot(struct cacheitem *item, const char *hex,
224 const char *format, const char *prefix, 224 const char *format, const char *prefix,
225 const char *filename); 225 const char *filename);
226 226
227#endif /* CGIT_H */ 227#endif /* CGIT_H */
diff --git a/ui-log.c b/ui-log.c
index 75bbbe4..bb17e1d 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -45,25 +45,25 @@ void print_commit(struct commit *commit)
45 if (cgit_repo->enable_log_linecount) { 45 if (cgit_repo->enable_log_linecount) {
46 html("</td><td class='right'>"); 46 html("</td><td class='right'>");
47 htmlf("%d", lines); 47 htmlf("%d", lines);
48 } 48 }
49 } 49 }
50 html("</td><td>"); 50 html("</td><td>");
51 html_txt(info->author); 51 html_txt(info->author);
52 html("</td></tr>\n"); 52 html("</td></tr>\n");
53 cgit_free_commitinfo(info); 53 cgit_free_commitinfo(info);
54} 54}
55 55
56 56
57void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path) 57void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager)
58{ 58{
59 struct rev_info rev; 59 struct rev_info rev;
60 struct commit *commit; 60 struct commit *commit;
61 const char *argv[] = {NULL, tip, NULL, NULL, NULL}; 61 const char *argv[] = {NULL, tip, NULL, NULL, NULL};
62 int argc = 2; 62 int argc = 2;
63 int i; 63 int i;
64 64
65 if (grep) 65 if (grep)
66 argv[argc++] = fmt("--grep=%s", grep); 66 argv[argc++] = fmt("--grep=%s", grep);
67 if (path) { 67 if (path) {
68 argv[argc++] = "--"; 68 argv[argc++] = "--";
69 argv[argc++] = path; 69 argv[argc++] = path;
@@ -101,28 +101,30 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path)
101 commit->parents = NULL; 101 commit->parents = NULL;
102 } 102 }
103 103
104 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) { 104 for (i = 0; i < cnt && (commit = get_revision(&rev)) != NULL; i++) {
105 print_commit(commit); 105 print_commit(commit);
106 free(commit->buffer); 106 free(commit->buffer);
107 commit->buffer = NULL; 107 commit->buffer = NULL;
108 free_commit_list(commit->parents); 108 free_commit_list(commit->parents);
109 commit->parents = NULL; 109 commit->parents = NULL;
110 } 110 }
111 html("</table>\n"); 111 html("</table>\n");
112 112
113 html("<div class='pager'>"); 113 if (pager) {
114 if (ofs > 0) { 114 html("<div class='pager'>");
115 html("&nbsp;<a href='"); 115 if (ofs > 0) {
116 html(cgit_pageurl(cgit_query_repo, cgit_query_page, 116 html("&nbsp;<a href='");
117 fmt("h=%s&amp;ofs=%d", tip, ofs-cnt))); 117 html(cgit_pageurl(cgit_query_repo, cgit_query_page,
118 html("'>[prev]</a>&nbsp;"); 118 fmt("h=%s&amp;ofs=%d", tip, ofs-cnt)));
119 } 119 html("'>[prev]</a>&nbsp;");
120 120 }
121 if ((commit = get_revision(&rev)) != NULL) { 121
122 html("&nbsp;<a href='"); 122 if ((commit = get_revision(&rev)) != NULL) {
123 html(cgit_pageurl(cgit_query_repo, "log", 123 html("&nbsp;<a href='");
124 fmt("h=%s&amp;ofs=%d", tip, ofs+cnt))); 124 html(cgit_pageurl(cgit_query_repo, "log",
125 html("'>[next]</a>&nbsp;"); 125 fmt("h=%s&amp;ofs=%d", tip, ofs+cnt)));
126 html("'>[next]</a>&nbsp;");
127 }
128 html("</div>");
126 } 129 }
127 html("</div>");
128} 130}