summaryrefslogtreecommitdiffabout
path: root/cgit.h
Unidiff
Diffstat (limited to 'cgit.h') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/cgit.h b/cgit.h
index bed770b..74aa340 100644
--- a/cgit.h
+++ b/cgit.h
@@ -21,301 +21,302 @@
21#include <utf8.h> 21#include <utf8.h>
22#include <notes.h> 22#include <notes.h>
23#include <graph.h> 23#include <graph.h>
24 24
25 25
26/* 26/*
27 * Dateformats used on misc. pages 27 * Dateformats used on misc. pages
28 */ 28 */
29#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" 29#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)"
30#define FMT_SHORTDATE "%Y-%m-%d" 30#define FMT_SHORTDATE "%Y-%m-%d"
31#define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" 31#define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ"
32 32
33 33
34/* 34/*
35 * Limits used for relative dates 35 * Limits used for relative dates
36 */ 36 */
37#define TM_MIN 60 37#define TM_MIN 60
38#define TM_HOUR (TM_MIN * 60) 38#define TM_HOUR (TM_MIN * 60)
39#define TM_DAY (TM_HOUR * 24) 39#define TM_DAY (TM_HOUR * 24)
40#define TM_WEEK (TM_DAY * 7) 40#define TM_WEEK (TM_DAY * 7)
41#define TM_YEAR (TM_DAY * 365) 41#define TM_YEAR (TM_DAY * 365)
42#define TM_MONTH (TM_YEAR / 12.0) 42#define TM_MONTH (TM_YEAR / 12.0)
43 43
44 44
45/* 45/*
46 * Default encoding 46 * Default encoding
47 */ 47 */
48#define PAGE_ENCODING "UTF-8" 48#define PAGE_ENCODING "UTF-8"
49 49
50typedef void (*configfn)(const char *name, const char *value); 50typedef void (*configfn)(const char *name, const char *value);
51typedef void (*filepair_fn)(struct diff_filepair *pair); 51typedef void (*filepair_fn)(struct diff_filepair *pair);
52typedef void (*linediff_fn)(char *line, int len); 52typedef void (*linediff_fn)(char *line, int len);
53 53
54struct cgit_filter { 54struct cgit_filter {
55 char *cmd; 55 char *cmd;
56 char **argv; 56 char **argv;
57 int old_stdout; 57 int old_stdout;
58 int pipe_fh[2]; 58 int pipe_fh[2];
59 int pid; 59 int pid;
60 int exitstatus; 60 int exitstatus;
61}; 61};
62 62
63struct cgit_repo { 63struct cgit_repo {
64 char *url; 64 char *url;
65 char *name; 65 char *name;
66 char *path; 66 char *path;
67 char *desc; 67 char *desc;
68 char *owner; 68 char *owner;
69 char *defbranch; 69 char *defbranch;
70 char *module_link; 70 char *module_link;
71 char *readme; 71 char *readme;
72 char *section; 72 char *section;
73 char *clone_url; 73 char *clone_url;
74 int snapshots; 74 int snapshots;
75 int enable_commit_graph; 75 int enable_commit_graph;
76 int enable_log_filecount; 76 int enable_log_filecount;
77 int enable_log_linecount; 77 int enable_log_linecount;
78 int enable_remote_branches; 78 int enable_remote_branches;
79 int enable_subject_links; 79 int enable_subject_links;
80 int max_stats; 80 int max_stats;
81 time_t mtime; 81 time_t mtime;
82 struct cgit_filter *about_filter; 82 struct cgit_filter *about_filter;
83 struct cgit_filter *commit_filter; 83 struct cgit_filter *commit_filter;
84 struct cgit_filter *source_filter; 84 struct cgit_filter *source_filter;
85}; 85};
86 86
87typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, 87typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name,
88 const char *value); 88 const char *value);
89 89
90struct cgit_repolist { 90struct cgit_repolist {
91 int length; 91 int length;
92 int count; 92 int count;
93 struct cgit_repo *repos; 93 struct cgit_repo *repos;
94}; 94};
95 95
96struct commitinfo { 96struct commitinfo {
97 struct commit *commit; 97 struct commit *commit;
98 char *author; 98 char *author;
99 char *author_email; 99 char *author_email;
100 unsigned long author_date; 100 unsigned long author_date;
101 char *committer; 101 char *committer;
102 char *committer_email; 102 char *committer_email;
103 unsigned long committer_date; 103 unsigned long committer_date;
104 char *subject; 104 char *subject;
105 char *msg; 105 char *msg;
106 char *msg_encoding; 106 char *msg_encoding;
107}; 107};
108 108
109struct taginfo { 109struct taginfo {
110 char *tagger; 110 char *tagger;
111 char *tagger_email; 111 char *tagger_email;
112 unsigned long tagger_date; 112 unsigned long tagger_date;
113 char *msg; 113 char *msg;
114}; 114};
115 115
116struct refinfo { 116struct refinfo {
117 const char *refname; 117 const char *refname;
118 struct object *object; 118 struct object *object;
119 union { 119 union {
120 struct taginfo *tag; 120 struct taginfo *tag;
121 struct commitinfo *commit; 121 struct commitinfo *commit;
122 }; 122 };
123}; 123};
124 124
125struct reflist { 125struct reflist {
126 struct refinfo **refs; 126 struct refinfo **refs;
127 int alloc; 127 int alloc;
128 int count; 128 int count;
129}; 129};
130 130
131struct cgit_query { 131struct cgit_query {
132 int has_symref; 132 int has_symref;
133 int has_sha1; 133 int has_sha1;
134 char *raw; 134 char *raw;
135 char *repo; 135 char *repo;
136 char *page; 136 char *page;
137 char *search; 137 char *search;
138 char *grep; 138 char *grep;
139 char *head; 139 char *head;
140 char *sha1; 140 char *sha1;
141 char *sha2; 141 char *sha2;
142 char *path; 142 char *path;
143 char *name; 143 char *name;
144 char *mimetype; 144 char *mimetype;
145 char *url; 145 char *url;
146 char *period; 146 char *period;
147 int ofs; 147 int ofs;
148 int nohead; 148 int nohead;
149 char *sort; 149 char *sort;
150 int showmsg; 150 int showmsg;
151 int ssdiff; 151 int ssdiff;
152 int show_all; 152 int show_all;
153 int context; 153 int context;
154 int ignorews; 154 int ignorews;
155 char *vpath; 155 char *vpath;
156}; 156};
157 157
158struct cgit_config { 158struct cgit_config {
159 char *agefile; 159 char *agefile;
160 char *cache_root; 160 char *cache_root;
161 char *clone_prefix; 161 char *clone_prefix;
162 char *css; 162 char *css;
163 char *favicon; 163 char *favicon;
164 char *footer; 164 char *footer;
165 char *head_include; 165 char *head_include;
166 char *header; 166 char *header;
167 char *index_header; 167 char *index_header;
168 char *index_info; 168 char *index_info;
169 char *logo; 169 char *logo;
170 char *logo_link; 170 char *logo_link;
171 char *module_link; 171 char *module_link;
172 char *project_list; 172 char *project_list;
173 char *readme; 173 char *readme;
174 char *robots; 174 char *robots;
175 char *root_title; 175 char *root_title;
176 char *root_desc; 176 char *root_desc;
177 char *root_readme; 177 char *root_readme;
178 char *script_name; 178 char *script_name;
179 char *section; 179 char *section;
180 char *virtual_root; 180 char *virtual_root;
181 char *strict_export; 181 char *strict_export;
182 int cache_size; 182 int cache_size;
183 int cache_dynamic_ttl; 183 int cache_dynamic_ttl;
184 int cache_max_create_time; 184 int cache_max_create_time;
185 int cache_repo_ttl; 185 int cache_repo_ttl;
186 int cache_root_ttl; 186 int cache_root_ttl;
187 int cache_scanrc_ttl; 187 int cache_scanrc_ttl;
188 int cache_static_ttl; 188 int cache_static_ttl;
189 int embedded; 189 int embedded;
190 int enable_filter_overrides; 190 int enable_filter_overrides;
191 int enable_gitweb_owner; 191 int enable_gitweb_owner;
192 int enable_index_links; 192 int enable_index_links;
193 int enable_commit_graph; 193 int enable_commit_graph;
194 int enable_log_filecount; 194 int enable_log_filecount;
195 int enable_log_linecount; 195 int enable_log_linecount;
196 int enable_remote_branches; 196 int enable_remote_branches;
197 int enable_subject_links; 197 int enable_subject_links;
198 int enable_tree_linenumbers; 198 int enable_tree_linenumbers;
199 int local_time; 199 int local_time;
200 int max_atom_items; 200 int max_atom_items;
201 int max_repo_count; 201 int max_repo_count;
202 int max_commit_count; 202 int max_commit_count;
203 int max_lock_attempts; 203 int max_lock_attempts;
204 int max_msg_len; 204 int max_msg_len;
205 int max_repodesc_len; 205 int max_repodesc_len;
206 int max_blob_size; 206 int max_blob_size;
207 int max_stats; 207 int max_stats;
208 int nocache; 208 int nocache;
209 int noplainemail; 209 int noplainemail;
210 int noheader; 210 int noheader;
211 int renamelimit; 211 int renamelimit;
212 int remove_suffix; 212 int remove_suffix;
213 int scan_hidden_path;
213 int section_from_path; 214 int section_from_path;
214 int snapshots; 215 int snapshots;
215 int summary_branches; 216 int summary_branches;
216 int summary_log; 217 int summary_log;
217 int summary_tags; 218 int summary_tags;
218 int ssdiff; 219 int ssdiff;
219 struct string_list mimetypes; 220 struct string_list mimetypes;
220 struct cgit_filter *about_filter; 221 struct cgit_filter *about_filter;
221 struct cgit_filter *commit_filter; 222 struct cgit_filter *commit_filter;
222 struct cgit_filter *source_filter; 223 struct cgit_filter *source_filter;
223}; 224};
224 225
225struct cgit_page { 226struct cgit_page {
226 time_t modified; 227 time_t modified;
227 time_t expires; 228 time_t expires;
228 size_t size; 229 size_t size;
229 char *mimetype; 230 char *mimetype;
230 char *charset; 231 char *charset;
231 char *filename; 232 char *filename;
232 char *etag; 233 char *etag;
233 char *title; 234 char *title;
234 int status; 235 int status;
235 char *statusmsg; 236 char *statusmsg;
236}; 237};
237 238
238struct cgit_environment { 239struct cgit_environment {
239 char *cgit_config; 240 char *cgit_config;
240 char *http_host; 241 char *http_host;
241 char *https; 242 char *https;
242 char *no_http; 243 char *no_http;
243 char *path_info; 244 char *path_info;
244 char *query_string; 245 char *query_string;
245 char *request_method; 246 char *request_method;
246 char *script_name; 247 char *script_name;
247 char *server_name; 248 char *server_name;
248 char *server_port; 249 char *server_port;
249}; 250};
250 251
251struct cgit_context { 252struct cgit_context {
252 struct cgit_environment env; 253 struct cgit_environment env;
253 struct cgit_query qry; 254 struct cgit_query qry;
254 struct cgit_config cfg; 255 struct cgit_config cfg;
255 struct cgit_repo *repo; 256 struct cgit_repo *repo;
256 struct cgit_page page; 257 struct cgit_page page;
257}; 258};
258 259
259struct cgit_snapshot_format { 260struct cgit_snapshot_format {
260 const char *suffix; 261 const char *suffix;
261 const char *mimetype; 262 const char *mimetype;
262 write_archive_fn_t write_func; 263 write_archive_fn_t write_func;
263 int bit; 264 int bit;
264}; 265};
265 266
266extern const char *cgit_version; 267extern const char *cgit_version;
267 268
268extern struct cgit_repolist cgit_repolist; 269extern struct cgit_repolist cgit_repolist;
269extern struct cgit_context ctx; 270extern struct cgit_context ctx;
270extern const struct cgit_snapshot_format cgit_snapshot_formats[]; 271extern const struct cgit_snapshot_format cgit_snapshot_formats[];
271 272
272extern struct cgit_repo *cgit_add_repo(const char *url); 273extern struct cgit_repo *cgit_add_repo(const char *url);
273extern struct cgit_repo *cgit_get_repoinfo(const char *url); 274extern struct cgit_repo *cgit_get_repoinfo(const char *url);
274extern void cgit_repo_config_cb(const char *name, const char *value); 275extern void cgit_repo_config_cb(const char *name, const char *value);
275 276
276extern int chk_zero(int result, char *msg); 277extern int chk_zero(int result, char *msg);
277extern int chk_positive(int result, char *msg); 278extern int chk_positive(int result, char *msg);
278extern int chk_non_negative(int result, char *msg); 279extern int chk_non_negative(int result, char *msg);
279 280
280extern char *trim_end(const char *str, char c); 281extern char *trim_end(const char *str, char c);
281extern char *strlpart(char *txt, int maxlen); 282extern char *strlpart(char *txt, int maxlen);
282extern char *strrpart(char *txt, int maxlen); 283extern char *strrpart(char *txt, int maxlen);
283 284
284extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); 285extern void cgit_add_ref(struct reflist *list, struct refinfo *ref);
285extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, 286extern int cgit_refs_cb(const char *refname, const unsigned char *sha1,
286 int flags, void *cb_data); 287 int flags, void *cb_data);
287 288
288extern void *cgit_free_commitinfo(struct commitinfo *info); 289extern void *cgit_free_commitinfo(struct commitinfo *info);
289 290
290extern int cgit_diff_files(const unsigned char *old_sha1, 291extern int cgit_diff_files(const unsigned char *old_sha1,
291 const unsigned char *new_sha1, 292 const unsigned char *new_sha1,
292 unsigned long *old_size, unsigned long *new_size, 293 unsigned long *old_size, unsigned long *new_size,
293 int *binary, int context, int ignorews, 294 int *binary, int context, int ignorews,
294 linediff_fn fn); 295 linediff_fn fn);
295 296
296extern void cgit_diff_tree(const unsigned char *old_sha1, 297extern void cgit_diff_tree(const unsigned char *old_sha1,
297 const unsigned char *new_sha1, 298 const unsigned char *new_sha1,
298 filepair_fn fn, const char *prefix, int ignorews); 299 filepair_fn fn, const char *prefix, int ignorews);
299 300
300extern void cgit_diff_commit(struct commit *commit, filepair_fn fn, 301extern void cgit_diff_commit(struct commit *commit, filepair_fn fn,
301 const char *prefix); 302 const char *prefix);
302 303
303__attribute__((format (printf,1,2))) 304__attribute__((format (printf,1,2)))
304extern char *fmt(const char *format,...); 305extern char *fmt(const char *format,...);
305 306
306extern struct commitinfo *cgit_parse_commit(struct commit *commit); 307extern struct commitinfo *cgit_parse_commit(struct commit *commit);
307extern struct taginfo *cgit_parse_tag(struct tag *tag); 308extern struct taginfo *cgit_parse_tag(struct tag *tag);
308extern void cgit_parse_url(const char *url); 309extern void cgit_parse_url(const char *url);
309 310
310extern const char *cgit_repobasename(const char *reponame); 311extern const char *cgit_repobasename(const char *reponame);
311 312
312extern int cgit_parse_snapshots_mask(const char *str); 313extern int cgit_parse_snapshots_mask(const char *str);
313 314
314extern int cgit_open_filter(struct cgit_filter *filter); 315extern int cgit_open_filter(struct cgit_filter *filter);
315extern int cgit_close_filter(struct cgit_filter *filter); 316extern int cgit_close_filter(struct cgit_filter *filter);
316 317
317extern int readfile(const char *path, char **buf, size_t *size); 318extern int readfile(const char *path, char **buf, size_t *size);
318 319
319extern char *expand_macros(const char *txt); 320extern char *expand_macros(const char *txt);
320 321
321#endif /* CGIT_H */ 322#endif /* CGIT_H */