summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c12
-rw-r--r--cgit.h12
-rw-r--r--ui-blob.c2
-rw-r--r--ui-patch.c2
-rw-r--r--ui-repolist.c2
-rw-r--r--ui-snapshot.c3
6 files changed, 16 insertions, 17 deletions
diff --git a/cgit.c b/cgit.c
index d0f6905..a83f0be 100644
--- a/cgit.c
+++ b/cgit.c
@@ -78,13 +78,13 @@ char *find_default_branch(struct cgit_repo *repo)
78 if (info.match) 78 if (info.match)
79 return info.req_ref; 79 return info.req_ref;
80 else 80 else
81 return info.first_ref; 81 return info.first_ref;
82} 82}
83 83
84static void cgit_print_repo_page(struct cacheitem *item) 84static void cgit_print_repo_page()
85{ 85{
86 char *tmp; 86 char *tmp;
87 int show_search; 87 int show_search;
88 unsigned char sha1[20]; 88 unsigned char sha1[20];
89 int nongit = 0; 89 int nongit = 0;
90 90
@@ -129,26 +129,26 @@ static void cgit_print_repo_page(struct cacheitem *item)
129 cgit_print_error(fmt("Invalid branch: %s", tmp)); 129 cgit_print_error(fmt("Invalid branch: %s", tmp));
130 cgit_print_docend(); 130 cgit_print_docend();
131 return; 131 return;
132 } 132 }
133 133
134 if ((cgit_cmd == CMD_SNAPSHOT) && ctx.repo->snapshots) { 134 if ((cgit_cmd == CMD_SNAPSHOT) && ctx.repo->snapshots) {
135 cgit_print_snapshot(item, ctx.qry.head, ctx.qry.sha1, 135 cgit_print_snapshot(ctx.qry.head, ctx.qry.sha1,
136 cgit_repobasename(ctx.repo->url), 136 cgit_repobasename(ctx.repo->url),
137 ctx.qry.path, 137 ctx.qry.path,
138 ctx.repo->snapshots ); 138 ctx.repo->snapshots );
139 return; 139 return;
140 } 140 }
141 141
142 if (cgit_cmd == CMD_PATCH) { 142 if (cgit_cmd == CMD_PATCH) {
143 cgit_print_patch(ctx.qry.sha1, item); 143 cgit_print_patch(ctx.qry.sha1);
144 return; 144 return;
145 } 145 }
146 146
147 if (cgit_cmd == CMD_BLOB) { 147 if (cgit_cmd == CMD_BLOB) {
148 cgit_print_blob(item, ctx.qry.sha1, ctx.qry.path); 148 cgit_print_blob(ctx.qry.sha1, ctx.qry.path);
149 return; 149 return;
150 } 150 }
151 151
152 show_search = (cgit_cmd == CMD_LOG); 152 show_search = (cgit_cmd == CMD_LOG);
153 cgit_print_http_headers(&ctx); 153 cgit_print_http_headers(&ctx);
154 cgit_print_docstart(&ctx); 154 cgit_print_docstart(&ctx);
@@ -207,15 +207,15 @@ static void cgit_fill_cache(struct cacheitem *item, int use_cache)
207 chk_positive(dup2(item->fd, STDOUT_FILENO), "Dup2(cachefile)"); 207 chk_positive(dup2(item->fd, STDOUT_FILENO), "Dup2(cachefile)");
208 } 208 }
209 209
210 ctx.page.modified = time(NULL); 210 ctx.page.modified = time(NULL);
211 ctx.page.expires = ctx.page.modified + ttl_seconds(item->ttl); 211 ctx.page.expires = ctx.page.modified + ttl_seconds(item->ttl);
212 if (ctx.repo) 212 if (ctx.repo)
213 cgit_print_repo_page(item); 213 cgit_print_repo_page();
214 else 214 else
215 cgit_print_repolist(item); 215 cgit_print_repolist();
216 216
217 if (use_cache) { 217 if (use_cache) {
218 chk_zero(close(STDOUT_FILENO), "Close redirected STDOUT"); 218 chk_zero(close(STDOUT_FILENO), "Close redirected STDOUT");
219 chk_positive(dup2(stdout2, STDOUT_FILENO), 219 chk_positive(dup2(stdout2, STDOUT_FILENO),
220 "Restoring original STDOUT"); 220 "Restoring original STDOUT");
221 chk_zero(close(stdout2), "Closing temporary STDOUT"); 221 chk_zero(close(stdout2), "Closing temporary STDOUT");
diff --git a/cgit.h b/cgit.h
index 8ab8e07..40e2d40 100644
--- a/cgit.h
+++ b/cgit.h
@@ -275,25 +275,25 @@ extern void cgit_print_docstart(struct cgit_context *ctx);
275extern void cgit_print_docend(); 275extern void cgit_print_docend();
276extern void cgit_print_pageheader(struct cgit_context *ctx); 276extern void cgit_print_pageheader(struct cgit_context *ctx);
277extern void cgit_print_filemode(unsigned short mode); 277extern void cgit_print_filemode(unsigned short mode);
278extern void cgit_print_branches(int maxcount); 278extern void cgit_print_branches(int maxcount);
279extern void cgit_print_tags(int maxcount); 279extern void cgit_print_tags(int maxcount);
280 280
281extern void cgit_print_repolist(struct cacheitem *item); 281extern void cgit_print_repolist();
282extern void cgit_print_summary(); 282extern void cgit_print_summary();
283extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, 283extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep,
284 char *pattern, char *path, int pager); 284 char *pattern, char *path, int pager);
285extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); 285extern void cgit_print_blob(const char *hex, char *path);
286extern void cgit_print_tree(const char *rev, char *path); 286extern void cgit_print_tree(const char *rev, char *path);
287extern void cgit_print_commit(char *hex); 287extern void cgit_print_commit(char *hex);
288extern void cgit_print_refs(); 288extern void cgit_print_refs();
289extern void cgit_print_tag(char *revname); 289extern void cgit_print_tag(char *revname);
290extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix); 290extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix);
291extern void cgit_print_patch(char *hex, struct cacheitem *item); 291extern void cgit_print_patch(char *hex);
292extern void cgit_print_snapshot(struct cacheitem *item, const char *head, 292extern void cgit_print_snapshot(const char *head, const char *hex,
293 const char *hex, const char *prefix, 293 const char *prefix, const char *filename,
294 const char *filename, int snapshot); 294 int snapshot);
295extern void cgit_print_snapshot_links(const char *repo, const char *head, 295extern void cgit_print_snapshot_links(const char *repo, const char *head,
296 const char *hex, int snapshots); 296 const char *hex, int snapshots);
297extern int cgit_parse_snapshots_mask(const char *str); 297extern int cgit_parse_snapshots_mask(const char *str);
298 298
299#endif /* CGIT_H */ 299#endif /* CGIT_H */
diff --git a/ui-blob.c b/ui-blob.c
index bd44574..3b29132 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -6,13 +6,13 @@
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 11
12void cgit_print_blob(struct cacheitem *item, const char *hex, char *path) 12void cgit_print_blob(const char *hex, char *path)
13{ 13{
14 14
15 unsigned char sha1[20]; 15 unsigned char sha1[20];
16 enum object_type type; 16 enum object_type type;
17 unsigned char *buf; 17 unsigned char *buf;
18 unsigned long size; 18 unsigned long size;
diff --git a/ui-patch.c b/ui-patch.c
index a77f3f6..68ebb15 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -66,13 +66,13 @@ static void filepair_cb(struct diff_filepair *pair)
66 return; 66 return;
67 } 67 }
68 if (cgit_diff_files(pair->one->sha1, pair->two->sha1, print_line)) 68 if (cgit_diff_files(pair->one->sha1, pair->two->sha1, print_line))
69 html("Error running diff"); 69 html("Error running diff");
70} 70}
71 71
72void cgit_print_patch(char *hex, struct cacheitem *item) 72void cgit_print_patch(char *hex)
73{ 73{
74 struct commit *commit; 74 struct commit *commit;
75 struct commitinfo *info; 75 struct commitinfo *info;
76 unsigned char sha1[20], old_sha1[20]; 76 unsigned char sha1[20], old_sha1[20];
77 char *patchname; 77 char *patchname;
78 78
diff --git a/ui-repolist.c b/ui-repolist.c
index e663585..ad9b1bc 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -40,13 +40,13 @@ static void print_modtime(struct cgit_repo *repo)
40 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch); 40 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch);
41 if (stat(path, &s) != 0) 41 if (stat(path, &s) != 0)
42 return; 42 return;
43 cgit_print_age(s.st_mtime, -1, NULL); 43 cgit_print_age(s.st_mtime, -1, NULL);
44} 44}
45 45
46void cgit_print_repolist(struct cacheitem *item) 46void cgit_print_repolist()
47{ 47{
48 int i, columns = 4; 48 int i, columns = 4;
49 char *last_group = NULL; 49 char *last_group = NULL;
50 50
51 if (ctx.cfg.enable_index_links) 51 if (ctx.cfg.enable_index_links)
52 columns++; 52 columns++;
diff --git a/ui-snapshot.c b/ui-snapshot.c
index 4449803..c741469 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -66,14 +66,13 @@ static const struct snapshot_archive_t {
66 { ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 }, 66 { ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 },
67 { ".tar", "application/x-tar", write_tar_archive, 0x8 } 67 { ".tar", "application/x-tar", write_tar_archive, 0x8 }
68}; 68};
69 69
70#define snapshot_archives_len (sizeof(snapshot_archives) / sizeof(*snapshot_archives)) 70#define snapshot_archives_len (sizeof(snapshot_archives) / sizeof(*snapshot_archives))
71 71
72void cgit_print_snapshot(struct cacheitem *item, const char *head, 72void cgit_print_snapshot(const char *head, const char *hex, const char *prefix,
73 const char *hex, const char *prefix,
74 const char *filename, int snapshots) 73 const char *filename, int snapshots)
75{ 74{
76 const struct snapshot_archive_t* sat; 75 const struct snapshot_archive_t* sat;
77 struct archiver_args args; 76 struct archiver_args args;
78 struct commit *commit; 77 struct commit *commit;
79 unsigned char sha1[20]; 78 unsigned char sha1[20];