|
diff --git a/cgit.c b/cgit.c index 9305d0a..ed2be64 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -189,128 +189,130 @@ void config_cb(const char *name, const char *value) |
189 | else if (!strcmp(name, "summary-tags")) |
189 | else if (!strcmp(name, "summary-tags")) |
190 | ctx.cfg.summary_tags = atoi(value); |
190 | ctx.cfg.summary_tags = atoi(value); |
191 | else if (!strcmp(name, "side-by-side-diffs")) |
191 | else if (!strcmp(name, "side-by-side-diffs")) |
192 | ctx.cfg.ssdiff = atoi(value); |
192 | ctx.cfg.ssdiff = atoi(value); |
193 | else if (!strcmp(name, "agefile")) |
193 | else if (!strcmp(name, "agefile")) |
194 | ctx.cfg.agefile = xstrdup(value); |
194 | ctx.cfg.agefile = xstrdup(value); |
195 | else if (!strcmp(name, "renamelimit")) |
195 | else if (!strcmp(name, "renamelimit")) |
196 | ctx.cfg.renamelimit = atoi(value); |
196 | ctx.cfg.renamelimit = atoi(value); |
197 | else if (!strcmp(name, "robots")) |
197 | else if (!strcmp(name, "robots")) |
198 | ctx.cfg.robots = xstrdup(value); |
198 | ctx.cfg.robots = xstrdup(value); |
199 | else if (!strcmp(name, "clone-prefix")) |
199 | else if (!strcmp(name, "clone-prefix")) |
200 | ctx.cfg.clone_prefix = xstrdup(value); |
200 | ctx.cfg.clone_prefix = xstrdup(value); |
201 | else if (!strcmp(name, "local-time")) |
201 | else if (!strcmp(name, "local-time")) |
202 | ctx.cfg.local_time = atoi(value); |
202 | ctx.cfg.local_time = atoi(value); |
203 | else if (!prefixcmp(name, "mimetype.")) |
203 | else if (!prefixcmp(name, "mimetype.")) |
204 | add_mimetype(name + 9, value); |
204 | add_mimetype(name + 9, value); |
205 | else if (!strcmp(name, "include")) |
205 | else if (!strcmp(name, "include")) |
206 | parse_configfile(value, config_cb); |
206 | parse_configfile(value, config_cb); |
207 | } |
207 | } |
208 | |
208 | |
209 | static void querystring_cb(const char *name, const char *value) |
209 | static void querystring_cb(const char *name, const char *value) |
210 | { |
210 | { |
211 | if (!value) |
211 | if (!value) |
212 | value = ""; |
212 | value = ""; |
213 | |
213 | |
214 | if (!strcmp(name,"r")) { |
214 | if (!strcmp(name,"r")) { |
215 | ctx.qry.repo = xstrdup(value); |
215 | ctx.qry.repo = xstrdup(value); |
216 | ctx.repo = cgit_get_repoinfo(value); |
216 | ctx.repo = cgit_get_repoinfo(value); |
217 | } else if (!strcmp(name, "p")) { |
217 | } else if (!strcmp(name, "p")) { |
218 | ctx.qry.page = xstrdup(value); |
218 | ctx.qry.page = xstrdup(value); |
219 | } else if (!strcmp(name, "url")) { |
219 | } else if (!strcmp(name, "url")) { |
220 | if (*value == '/') |
220 | if (*value == '/') |
221 | value++; |
221 | value++; |
222 | ctx.qry.url = xstrdup(value); |
222 | ctx.qry.url = xstrdup(value); |
223 | cgit_parse_url(value); |
223 | cgit_parse_url(value); |
224 | } else if (!strcmp(name, "qt")) { |
224 | } else if (!strcmp(name, "qt")) { |
225 | ctx.qry.grep = xstrdup(value); |
225 | ctx.qry.grep = xstrdup(value); |
226 | } else if (!strcmp(name, "q")) { |
226 | } else if (!strcmp(name, "q")) { |
227 | ctx.qry.search = xstrdup(value); |
227 | ctx.qry.search = xstrdup(value); |
228 | } else if (!strcmp(name, "h")) { |
228 | } else if (!strcmp(name, "h")) { |
229 | ctx.qry.head = xstrdup(value); |
229 | ctx.qry.head = xstrdup(value); |
230 | ctx.qry.has_symref = 1; |
230 | ctx.qry.has_symref = 1; |
231 | } else if (!strcmp(name, "id")) { |
231 | } else if (!strcmp(name, "id")) { |
232 | ctx.qry.sha1 = xstrdup(value); |
232 | ctx.qry.sha1 = xstrdup(value); |
233 | ctx.qry.has_sha1 = 1; |
233 | ctx.qry.has_sha1 = 1; |
234 | } else if (!strcmp(name, "id2")) { |
234 | } else if (!strcmp(name, "id2")) { |
235 | ctx.qry.sha2 = xstrdup(value); |
235 | ctx.qry.sha2 = xstrdup(value); |
236 | ctx.qry.has_sha1 = 1; |
236 | ctx.qry.has_sha1 = 1; |
237 | } else if (!strcmp(name, "ofs")) { |
237 | } else if (!strcmp(name, "ofs")) { |
238 | ctx.qry.ofs = atoi(value); |
238 | ctx.qry.ofs = atoi(value); |
239 | } else if (!strcmp(name, "path")) { |
239 | } else if (!strcmp(name, "path")) { |
240 | ctx.qry.path = trim_end(value, '/'); |
240 | ctx.qry.path = trim_end(value, '/'); |
241 | } else if (!strcmp(name, "name")) { |
241 | } else if (!strcmp(name, "name")) { |
242 | ctx.qry.name = xstrdup(value); |
242 | ctx.qry.name = xstrdup(value); |
243 | } else if (!strcmp(name, "mimetype")) { |
243 | } else if (!strcmp(name, "mimetype")) { |
244 | ctx.qry.mimetype = xstrdup(value); |
244 | ctx.qry.mimetype = xstrdup(value); |
245 | } else if (!strcmp(name, "s")){ |
245 | } else if (!strcmp(name, "s")){ |
246 | ctx.qry.sort = xstrdup(value); |
246 | ctx.qry.sort = xstrdup(value); |
247 | } else if (!strcmp(name, "showmsg")) { |
247 | } else if (!strcmp(name, "showmsg")) { |
248 | ctx.qry.showmsg = atoi(value); |
248 | ctx.qry.showmsg = atoi(value); |
249 | } else if (!strcmp(name, "period")) { |
249 | } else if (!strcmp(name, "period")) { |
250 | ctx.qry.period = xstrdup(value); |
250 | ctx.qry.period = xstrdup(value); |
251 | } else if (!strcmp(name, "ss")) { |
251 | } else if (!strcmp(name, "ss")) { |
252 | ctx.qry.ssdiff = atoi(value); |
252 | ctx.qry.ssdiff = atoi(value); |
| |
253 | } else if (!strcmp(name, "all")) { |
| |
254 | ctx.qry.show_all = atoi(value); |
253 | } |
255 | } |
254 | } |
256 | } |
255 | |
257 | |
256 | char *xstrdupn(const char *str) |
258 | char *xstrdupn(const char *str) |
257 | { |
259 | { |
258 | return (str ? xstrdup(str) : NULL); |
260 | return (str ? xstrdup(str) : NULL); |
259 | } |
261 | } |
260 | |
262 | |
261 | static void prepare_context(struct cgit_context *ctx) |
263 | static void prepare_context(struct cgit_context *ctx) |
262 | { |
264 | { |
263 | memset(ctx, 0, sizeof(*ctx)); |
265 | memset(ctx, 0, sizeof(*ctx)); |
264 | ctx->cfg.agefile = "info/web/last-modified"; |
266 | ctx->cfg.agefile = "info/web/last-modified"; |
265 | ctx->cfg.nocache = 0; |
267 | ctx->cfg.nocache = 0; |
266 | ctx->cfg.cache_size = 0; |
268 | ctx->cfg.cache_size = 0; |
267 | ctx->cfg.cache_dynamic_ttl = 5; |
269 | ctx->cfg.cache_dynamic_ttl = 5; |
268 | ctx->cfg.cache_max_create_time = 5; |
270 | ctx->cfg.cache_max_create_time = 5; |
269 | ctx->cfg.cache_repo_ttl = 5; |
271 | ctx->cfg.cache_repo_ttl = 5; |
270 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
272 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
271 | ctx->cfg.cache_root_ttl = 5; |
273 | ctx->cfg.cache_root_ttl = 5; |
272 | ctx->cfg.cache_scanrc_ttl = 15; |
274 | ctx->cfg.cache_scanrc_ttl = 15; |
273 | ctx->cfg.cache_static_ttl = -1; |
275 | ctx->cfg.cache_static_ttl = -1; |
274 | ctx->cfg.css = "/cgit.css"; |
276 | ctx->cfg.css = "/cgit.css"; |
275 | ctx->cfg.logo = "/cgit.png"; |
277 | ctx->cfg.logo = "/cgit.png"; |
276 | ctx->cfg.local_time = 0; |
278 | ctx->cfg.local_time = 0; |
277 | ctx->cfg.enable_tree_linenumbers = 1; |
279 | ctx->cfg.enable_tree_linenumbers = 1; |
278 | ctx->cfg.max_repo_count = 50; |
280 | ctx->cfg.max_repo_count = 50; |
279 | ctx->cfg.max_commit_count = 50; |
281 | ctx->cfg.max_commit_count = 50; |
280 | ctx->cfg.max_lock_attempts = 5; |
282 | ctx->cfg.max_lock_attempts = 5; |
281 | ctx->cfg.max_msg_len = 80; |
283 | ctx->cfg.max_msg_len = 80; |
282 | ctx->cfg.max_repodesc_len = 80; |
284 | ctx->cfg.max_repodesc_len = 80; |
283 | ctx->cfg.max_blob_size = 0; |
285 | ctx->cfg.max_blob_size = 0; |
284 | ctx->cfg.max_stats = 0; |
286 | ctx->cfg.max_stats = 0; |
285 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
287 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
286 | ctx->cfg.renamelimit = -1; |
288 | ctx->cfg.renamelimit = -1; |
287 | ctx->cfg.robots = "index, nofollow"; |
289 | ctx->cfg.robots = "index, nofollow"; |
288 | ctx->cfg.root_title = "Git repository browser"; |
290 | ctx->cfg.root_title = "Git repository browser"; |
289 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
291 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
290 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
292 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
291 | ctx->cfg.section = ""; |
293 | ctx->cfg.section = ""; |
292 | ctx->cfg.summary_branches = 10; |
294 | ctx->cfg.summary_branches = 10; |
293 | ctx->cfg.summary_log = 10; |
295 | ctx->cfg.summary_log = 10; |
294 | ctx->cfg.summary_tags = 10; |
296 | ctx->cfg.summary_tags = 10; |
295 | ctx->cfg.ssdiff = 0; |
297 | ctx->cfg.ssdiff = 0; |
296 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
298 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
297 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
299 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
298 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
300 | ctx->env.https = xstrdupn(getenv("HTTPS")); |
299 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); |
301 | ctx->env.no_http = xstrdupn(getenv("NO_HTTP")); |
300 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); |
302 | ctx->env.path_info = xstrdupn(getenv("PATH_INFO")); |
301 | ctx->env.query_string = xstrdupn(getenv("QUERY_STRING")); |
303 | ctx->env.query_string = xstrdupn(getenv("QUERY_STRING")); |
302 | ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD")); |
304 | ctx->env.request_method = xstrdupn(getenv("REQUEST_METHOD")); |
303 | ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME")); |
305 | ctx->env.script_name = xstrdupn(getenv("SCRIPT_NAME")); |
304 | ctx->env.server_name = xstrdupn(getenv("SERVER_NAME")); |
306 | ctx->env.server_name = xstrdupn(getenv("SERVER_NAME")); |
305 | ctx->env.server_port = xstrdupn(getenv("SERVER_PORT")); |
307 | ctx->env.server_port = xstrdupn(getenv("SERVER_PORT")); |
306 | ctx->page.mimetype = "text/html"; |
308 | ctx->page.mimetype = "text/html"; |
307 | ctx->page.charset = PAGE_ENCODING; |
309 | ctx->page.charset = PAGE_ENCODING; |
308 | ctx->page.filename = NULL; |
310 | ctx->page.filename = NULL; |
309 | ctx->page.size = 0; |
311 | ctx->page.size = 0; |
310 | ctx->page.modified = time(NULL); |
312 | ctx->page.modified = time(NULL); |
311 | ctx->page.expires = ctx->page.modified; |
313 | ctx->page.expires = ctx->page.modified; |
312 | ctx->page.etag = NULL; |
314 | ctx->page.etag = NULL; |
313 | memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list)); |
315 | memset(&ctx->cfg.mimetypes, 0, sizeof(struct string_list)); |
314 | if (ctx->env.script_name) |
316 | if (ctx->env.script_name) |
315 | ctx->cfg.script_name = ctx->env.script_name; |
317 | ctx->cfg.script_name = ctx->env.script_name; |
316 | if (ctx->env.query_string) |
318 | if (ctx->env.query_string) |
|
|
diff --git a/cgit.h b/cgit.h index cd4af72..478aebb 100644 --- a/ cgit.h+++ b/ cgit.h |
|
@@ -84,128 +84,129 @@ typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, |
84 | const char *value); |
84 | const char *value); |
85 | |
85 | |
86 | struct cgit_repolist { |
86 | struct cgit_repolist { |
87 | int length; |
87 | int length; |
88 | int count; |
88 | int count; |
89 | struct cgit_repo *repos; |
89 | struct cgit_repo *repos; |
90 | }; |
90 | }; |
91 | |
91 | |
92 | struct commitinfo { |
92 | struct commitinfo { |
93 | struct commit *commit; |
93 | struct commit *commit; |
94 | char *author; |
94 | char *author; |
95 | char *author_email; |
95 | char *author_email; |
96 | unsigned long author_date; |
96 | unsigned long author_date; |
97 | char *committer; |
97 | char *committer; |
98 | char *committer_email; |
98 | char *committer_email; |
99 | unsigned long committer_date; |
99 | unsigned long committer_date; |
100 | char *subject; |
100 | char *subject; |
101 | char *msg; |
101 | char *msg; |
102 | char *msg_encoding; |
102 | char *msg_encoding; |
103 | }; |
103 | }; |
104 | |
104 | |
105 | struct taginfo { |
105 | struct taginfo { |
106 | char *tagger; |
106 | char *tagger; |
107 | char *tagger_email; |
107 | char *tagger_email; |
108 | unsigned long tagger_date; |
108 | unsigned long tagger_date; |
109 | char *msg; |
109 | char *msg; |
110 | }; |
110 | }; |
111 | |
111 | |
112 | struct refinfo { |
112 | struct refinfo { |
113 | const char *refname; |
113 | const char *refname; |
114 | struct object *object; |
114 | struct object *object; |
115 | union { |
115 | union { |
116 | struct taginfo *tag; |
116 | struct taginfo *tag; |
117 | struct commitinfo *commit; |
117 | struct commitinfo *commit; |
118 | }; |
118 | }; |
119 | }; |
119 | }; |
120 | |
120 | |
121 | struct reflist { |
121 | struct reflist { |
122 | struct refinfo **refs; |
122 | struct refinfo **refs; |
123 | int alloc; |
123 | int alloc; |
124 | int count; |
124 | int count; |
125 | }; |
125 | }; |
126 | |
126 | |
127 | struct cgit_query { |
127 | struct cgit_query { |
128 | int has_symref; |
128 | int has_symref; |
129 | int has_sha1; |
129 | int has_sha1; |
130 | char *raw; |
130 | char *raw; |
131 | char *repo; |
131 | char *repo; |
132 | char *page; |
132 | char *page; |
133 | char *search; |
133 | char *search; |
134 | char *grep; |
134 | char *grep; |
135 | char *head; |
135 | char *head; |
136 | char *sha1; |
136 | char *sha1; |
137 | char *sha2; |
137 | char *sha2; |
138 | char *path; |
138 | char *path; |
139 | char *name; |
139 | char *name; |
140 | char *mimetype; |
140 | char *mimetype; |
141 | char *url; |
141 | char *url; |
142 | char *period; |
142 | char *period; |
143 | int ofs; |
143 | int ofs; |
144 | int nohead; |
144 | int nohead; |
145 | char *sort; |
145 | char *sort; |
146 | int showmsg; |
146 | int showmsg; |
147 | int ssdiff; |
147 | int ssdiff; |
| |
148 | int show_all; |
148 | }; |
149 | }; |
149 | |
150 | |
150 | struct cgit_config { |
151 | struct cgit_config { |
151 | char *agefile; |
152 | char *agefile; |
152 | char *cache_root; |
153 | char *cache_root; |
153 | char *clone_prefix; |
154 | char *clone_prefix; |
154 | char *css; |
155 | char *css; |
155 | char *favicon; |
156 | char *favicon; |
156 | char *footer; |
157 | char *footer; |
157 | char *head_include; |
158 | char *head_include; |
158 | char *header; |
159 | char *header; |
159 | char *index_header; |
160 | char *index_header; |
160 | char *index_info; |
161 | char *index_info; |
161 | char *logo; |
162 | char *logo; |
162 | char *logo_link; |
163 | char *logo_link; |
163 | char *module_link; |
164 | char *module_link; |
164 | char *robots; |
165 | char *robots; |
165 | char *root_title; |
166 | char *root_title; |
166 | char *root_desc; |
167 | char *root_desc; |
167 | char *root_readme; |
168 | char *root_readme; |
168 | char *script_name; |
169 | char *script_name; |
169 | char *section; |
170 | char *section; |
170 | char *virtual_root; |
171 | char *virtual_root; |
171 | int cache_size; |
172 | int cache_size; |
172 | int cache_dynamic_ttl; |
173 | int cache_dynamic_ttl; |
173 | int cache_max_create_time; |
174 | int cache_max_create_time; |
174 | int cache_repo_ttl; |
175 | int cache_repo_ttl; |
175 | int cache_root_ttl; |
176 | int cache_root_ttl; |
176 | int cache_scanrc_ttl; |
177 | int cache_scanrc_ttl; |
177 | int cache_static_ttl; |
178 | int cache_static_ttl; |
178 | int embedded; |
179 | int embedded; |
179 | int enable_filter_overrides; |
180 | int enable_filter_overrides; |
180 | int enable_index_links; |
181 | int enable_index_links; |
181 | int enable_log_filecount; |
182 | int enable_log_filecount; |
182 | int enable_log_linecount; |
183 | int enable_log_linecount; |
183 | int enable_remote_branches; |
184 | int enable_remote_branches; |
184 | int enable_tree_linenumbers; |
185 | int enable_tree_linenumbers; |
185 | int local_time; |
186 | int local_time; |
186 | int max_repo_count; |
187 | int max_repo_count; |
187 | int max_commit_count; |
188 | int max_commit_count; |
188 | int max_lock_attempts; |
189 | int max_lock_attempts; |
189 | int max_msg_len; |
190 | int max_msg_len; |
190 | int max_repodesc_len; |
191 | int max_repodesc_len; |
191 | int max_blob_size; |
192 | int max_blob_size; |
192 | int max_stats; |
193 | int max_stats; |
193 | int nocache; |
194 | int nocache; |
194 | int noplainemail; |
195 | int noplainemail; |
195 | int noheader; |
196 | int noheader; |
196 | int renamelimit; |
197 | int renamelimit; |
197 | int snapshots; |
198 | int snapshots; |
198 | int summary_branches; |
199 | int summary_branches; |
199 | int summary_log; |
200 | int summary_log; |
200 | int summary_tags; |
201 | int summary_tags; |
201 | int ssdiff; |
202 | int ssdiff; |
202 | struct string_list mimetypes; |
203 | struct string_list mimetypes; |
203 | struct cgit_filter *about_filter; |
204 | struct cgit_filter *about_filter; |
204 | struct cgit_filter *commit_filter; |
205 | struct cgit_filter *commit_filter; |
205 | struct cgit_filter *source_filter; |
206 | struct cgit_filter *source_filter; |
206 | }; |
207 | }; |
207 | |
208 | |
208 | struct cgit_page { |
209 | struct cgit_page { |
209 | time_t modified; |
210 | time_t modified; |
210 | time_t expires; |
211 | time_t expires; |
211 | size_t size; |
212 | size_t size; |
|
|
diff --git a/ui-atom.c b/ui-atom.c index 808b2d0..9f049ae 100644 --- a/ ui-atom.c+++ b/ ui-atom.c |
|
@@ -24,108 +24,110 @@ void add_entry(struct commit *commit, char *host) |
24 | html_txt(info->subject); |
24 | html_txt(info->subject); |
25 | html("</title>\n"); |
25 | html("</title>\n"); |
26 | html("<updated>"); |
26 | html("<updated>"); |
27 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); |
27 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); |
28 | html("</updated>\n"); |
28 | html("</updated>\n"); |
29 | html("<author>\n"); |
29 | html("<author>\n"); |
30 | if (info->author) { |
30 | if (info->author) { |
31 | html("<name>"); |
31 | html("<name>"); |
32 | html_txt(info->author); |
32 | html_txt(info->author); |
33 | html("</name>\n"); |
33 | html("</name>\n"); |
34 | } |
34 | } |
35 | if (info->author_email && !ctx.cfg.noplainemail) { |
35 | if (info->author_email && !ctx.cfg.noplainemail) { |
36 | mail = xstrdup(info->author_email); |
36 | mail = xstrdup(info->author_email); |
37 | t = strchr(mail, '<'); |
37 | t = strchr(mail, '<'); |
38 | if (t) |
38 | if (t) |
39 | t++; |
39 | t++; |
40 | else |
40 | else |
41 | t = mail; |
41 | t = mail; |
42 | t2 = strchr(t, '>'); |
42 | t2 = strchr(t, '>'); |
43 | if (t2) |
43 | if (t2) |
44 | *t2 = '\0'; |
44 | *t2 = '\0'; |
45 | html("<email>"); |
45 | html("<email>"); |
46 | html_txt(t); |
46 | html_txt(t); |
47 | html("</email>\n"); |
47 | html("</email>\n"); |
48 | free(mail); |
48 | free(mail); |
49 | } |
49 | } |
50 | html("</author>\n"); |
50 | html("</author>\n"); |
51 | html("<published>"); |
51 | html("<published>"); |
52 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); |
52 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); |
53 | html("</published>\n"); |
53 | html("</published>\n"); |
54 | if (host) { |
54 | if (host) { |
55 | html("<link rel='alternate' type='text/html' href='"); |
55 | html("<link rel='alternate' type='text/html' href='"); |
56 | html(cgit_httpscheme()); |
56 | html(cgit_httpscheme()); |
57 | html_attr(host); |
57 | html_attr(host); |
58 | html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL)); |
58 | html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL)); |
59 | if (ctx.cfg.virtual_root) |
59 | if (ctx.cfg.virtual_root) |
60 | delim = '?'; |
60 | delim = '?'; |
61 | htmlf("%cid=%s", delim, hex); |
61 | htmlf("%cid=%s", delim, hex); |
62 | html("'/>\n"); |
62 | html("'/>\n"); |
63 | } |
63 | } |
64 | htmlf("<id>%s</id>\n", hex); |
64 | htmlf("<id>%s</id>\n", hex); |
65 | html("<content type='text'>\n"); |
65 | html("<content type='text'>\n"); |
66 | html_txt(info->msg); |
66 | html_txt(info->msg); |
67 | html("</content>\n"); |
67 | html("</content>\n"); |
68 | html("<content type='xhtml'>\n"); |
68 | html("<content type='xhtml'>\n"); |
69 | html("<div xmlns='http://www.w3.org/1999/xhtml'>\n"); |
69 | html("<div xmlns='http://www.w3.org/1999/xhtml'>\n"); |
70 | html("<pre>\n"); |
70 | html("<pre>\n"); |
71 | html_txt(info->msg); |
71 | html_txt(info->msg); |
72 | html("</pre>\n"); |
72 | html("</pre>\n"); |
73 | html("</div>\n"); |
73 | html("</div>\n"); |
74 | html("</content>\n"); |
74 | html("</content>\n"); |
75 | html("</entry>\n"); |
75 | html("</entry>\n"); |
76 | cgit_free_commitinfo(info); |
76 | cgit_free_commitinfo(info); |
77 | } |
77 | } |
78 | |
78 | |
79 | |
79 | |
80 | void cgit_print_atom(char *tip, char *path, int max_count) |
80 | void cgit_print_atom(char *tip, char *path, int max_count) |
81 | { |
81 | { |
82 | char *host; |
82 | char *host; |
83 | const char *argv[] = {NULL, tip, NULL, NULL, NULL}; |
83 | const char *argv[] = {NULL, tip, NULL, NULL, NULL}; |
84 | struct commit *commit; |
84 | struct commit *commit; |
85 | struct rev_info rev; |
85 | struct rev_info rev; |
86 | int argc = 2; |
86 | int argc = 2; |
87 | |
87 | |
88 | if (!tip) |
88 | if (ctx.qry.show_all) |
| |
89 | argv[1] = "--all"; |
| |
90 | else if (!tip) |
89 | argv[1] = ctx.qry.head; |
91 | argv[1] = ctx.qry.head; |
90 | |
92 | |
91 | if (path) { |
93 | if (path) { |
92 | argv[argc++] = "--"; |
94 | argv[argc++] = "--"; |
93 | argv[argc++] = path; |
95 | argv[argc++] = path; |
94 | } |
96 | } |
95 | |
97 | |
96 | init_revisions(&rev, NULL); |
98 | init_revisions(&rev, NULL); |
97 | rev.abbrev = DEFAULT_ABBREV; |
99 | rev.abbrev = DEFAULT_ABBREV; |
98 | rev.commit_format = CMIT_FMT_DEFAULT; |
100 | rev.commit_format = CMIT_FMT_DEFAULT; |
99 | rev.verbose_header = 1; |
101 | rev.verbose_header = 1; |
100 | rev.show_root_diff = 0; |
102 | rev.show_root_diff = 0; |
101 | rev.max_count = max_count; |
103 | rev.max_count = max_count; |
102 | setup_revisions(argc, argv, &rev, NULL); |
104 | setup_revisions(argc, argv, &rev, NULL); |
103 | prepare_revision_walk(&rev); |
105 | prepare_revision_walk(&rev); |
104 | |
106 | |
105 | host = cgit_hosturl(); |
107 | host = cgit_hosturl(); |
106 | ctx.page.mimetype = "text/xml"; |
108 | ctx.page.mimetype = "text/xml"; |
107 | ctx.page.charset = "utf-8"; |
109 | ctx.page.charset = "utf-8"; |
108 | cgit_print_http_headers(&ctx); |
110 | cgit_print_http_headers(&ctx); |
109 | html("<feed xmlns='http://www.w3.org/2005/Atom'>\n"); |
111 | html("<feed xmlns='http://www.w3.org/2005/Atom'>\n"); |
110 | html("<title>"); |
112 | html("<title>"); |
111 | html_txt(ctx.repo->name); |
113 | html_txt(ctx.repo->name); |
112 | html("</title>\n"); |
114 | html("</title>\n"); |
113 | html("<subtitle>"); |
115 | html("<subtitle>"); |
114 | html_txt(ctx.repo->desc); |
116 | html_txt(ctx.repo->desc); |
115 | html("</subtitle>\n"); |
117 | html("</subtitle>\n"); |
116 | if (host) { |
118 | if (host) { |
117 | html("<link rel='alternate' type='text/html' href='"); |
119 | html("<link rel='alternate' type='text/html' href='"); |
118 | html(cgit_httpscheme()); |
120 | html(cgit_httpscheme()); |
119 | html_attr(host); |
121 | html_attr(host); |
120 | html_attr(cgit_repourl(ctx.repo->url)); |
122 | html_attr(cgit_repourl(ctx.repo->url)); |
121 | html("'/>\n"); |
123 | html("'/>\n"); |
122 | } |
124 | } |
123 | while ((commit = get_revision(&rev)) != NULL) { |
125 | while ((commit = get_revision(&rev)) != NULL) { |
124 | add_entry(commit, host); |
126 | add_entry(commit, host); |
125 | free(commit->buffer); |
127 | free(commit->buffer); |
126 | commit->buffer = NULL; |
128 | commit->buffer = NULL; |
127 | free_commit_list(commit->parents); |
129 | free_commit_list(commit->parents); |
128 | commit->parents = NULL; |
130 | commit->parents = NULL; |
129 | } |
131 | } |
130 | html("</feed>\n"); |
132 | html("</feed>\n"); |
131 | } |
133 | } |
|