summaryrefslogtreecommitdiffabout
path: root/cgit.h
authorLars Hjemli <hjemli@gmail.com>2009-08-09 11:27:21 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-08-09 11:41:54 (UTC)
commit537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4 (patch) (unidiff)
tree73b1d25a96dd171c5503fae1fefc6a27a7d58683 /cgit.h
parente1782fff8a78b7f265432603351281ad2988bb40 (diff)
downloadcgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.zip
cgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.tar.gz
cgit-537c05f138d59c1eb3ac8e2d8b0dca3a38aa5dd4.tar.bz2
Add 'about-filter' and 'repo.about-filter' options
These options can be used to execute a filter command on each about-page, both top-level and for each repository (repo.about-filter can be used to override the current about-filter). Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.h') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/cgit.h b/cgit.h
index f10ba05..b8f4850 100644
--- a/cgit.h
+++ b/cgit.h
@@ -1,268 +1,270 @@
1#ifndef CGIT_H 1#ifndef CGIT_H
2#define CGIT_H 2#define CGIT_H
3 3
4 4
5#include <git-compat-util.h> 5#include <git-compat-util.h>
6#include <cache.h> 6#include <cache.h>
7#include <grep.h> 7#include <grep.h>
8#include <object.h> 8#include <object.h>
9#include <tree.h> 9#include <tree.h>
10#include <commit.h> 10#include <commit.h>
11#include <tag.h> 11#include <tag.h>
12#include <diff.h> 12#include <diff.h>
13#include <diffcore.h> 13#include <diffcore.h>
14#include <refs.h> 14#include <refs.h>
15#include <revision.h> 15#include <revision.h>
16#include <log-tree.h> 16#include <log-tree.h>
17#include <archive.h> 17#include <archive.h>
18#include <xdiff-interface.h> 18#include <xdiff-interface.h>
19#include <xdiff/xdiff.h> 19#include <xdiff/xdiff.h>
20#include <utf8.h> 20#include <utf8.h>
21 21
22 22
23/* 23/*
24 * Dateformats used on misc. pages 24 * Dateformats used on misc. pages
25 */ 25 */
26#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" 26#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)"
27#define FMT_SHORTDATE "%Y-%m-%d" 27#define FMT_SHORTDATE "%Y-%m-%d"
28#define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" 28#define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ"
29 29
30 30
31/* 31/*
32 * Limits used for relative dates 32 * Limits used for relative dates
33 */ 33 */
34#define TM_MIN 60 34#define TM_MIN 60
35#define TM_HOUR (TM_MIN * 60) 35#define TM_HOUR (TM_MIN * 60)
36#define TM_DAY (TM_HOUR * 24) 36#define TM_DAY (TM_HOUR * 24)
37#define TM_WEEK (TM_DAY * 7) 37#define TM_WEEK (TM_DAY * 7)
38#define TM_YEAR (TM_DAY * 365) 38#define TM_YEAR (TM_DAY * 365)
39#define TM_MONTH (TM_YEAR / 12.0) 39#define TM_MONTH (TM_YEAR / 12.0)
40 40
41 41
42/* 42/*
43 * Default encoding 43 * Default encoding
44 */ 44 */
45#define PAGE_ENCODING "UTF-8" 45#define PAGE_ENCODING "UTF-8"
46 46
47typedef void (*configfn)(const char *name, const char *value); 47typedef void (*configfn)(const char *name, const char *value);
48typedef void (*filepair_fn)(struct diff_filepair *pair); 48typedef void (*filepair_fn)(struct diff_filepair *pair);
49typedef void (*linediff_fn)(char *line, int len); 49typedef void (*linediff_fn)(char *line, int len);
50 50
51struct cgit_filter { 51struct cgit_filter {
52 char *cmd; 52 char *cmd;
53 char **argv; 53 char **argv;
54 int old_stdout; 54 int old_stdout;
55 int pipe_fh[2]; 55 int pipe_fh[2];
56 int pid; 56 int pid;
57 int exitstatus; 57 int exitstatus;
58}; 58};
59 59
60struct cgit_repo { 60struct cgit_repo {
61 char *url; 61 char *url;
62 char *name; 62 char *name;
63 char *path; 63 char *path;
64 char *desc; 64 char *desc;
65 char *owner; 65 char *owner;
66 char *defbranch; 66 char *defbranch;
67 char *group; 67 char *group;
68 char *module_link; 68 char *module_link;
69 char *readme; 69 char *readme;
70 char *clone_url; 70 char *clone_url;
71 int snapshots; 71 int snapshots;
72 int enable_log_filecount; 72 int enable_log_filecount;
73 int enable_log_linecount; 73 int enable_log_linecount;
74 int max_stats; 74 int max_stats;
75 time_t mtime; 75 time_t mtime;
76 struct cgit_filter *about_filter;
76 struct cgit_filter *commit_filter; 77 struct cgit_filter *commit_filter;
77 struct cgit_filter *source_filter; 78 struct cgit_filter *source_filter;
78}; 79};
79 80
80struct cgit_repolist { 81struct cgit_repolist {
81 int length; 82 int length;
82 int count; 83 int count;
83 struct cgit_repo *repos; 84 struct cgit_repo *repos;
84}; 85};
85 86
86struct commitinfo { 87struct commitinfo {
87 struct commit *commit; 88 struct commit *commit;
88 char *author; 89 char *author;
89 char *author_email; 90 char *author_email;
90 unsigned long author_date; 91 unsigned long author_date;
91 char *committer; 92 char *committer;
92 char *committer_email; 93 char *committer_email;
93 unsigned long committer_date; 94 unsigned long committer_date;
94 char *subject; 95 char *subject;
95 char *msg; 96 char *msg;
96 char *msg_encoding; 97 char *msg_encoding;
97}; 98};
98 99
99struct taginfo { 100struct taginfo {
100 char *tagger; 101 char *tagger;
101 char *tagger_email; 102 char *tagger_email;
102 unsigned long tagger_date; 103 unsigned long tagger_date;
103 char *msg; 104 char *msg;
104}; 105};
105 106
106struct refinfo { 107struct refinfo {
107 const char *refname; 108 const char *refname;
108 struct object *object; 109 struct object *object;
109 union { 110 union {
110 struct taginfo *tag; 111 struct taginfo *tag;
111 struct commitinfo *commit; 112 struct commitinfo *commit;
112 }; 113 };
113}; 114};
114 115
115struct reflist { 116struct reflist {
116 struct refinfo **refs; 117 struct refinfo **refs;
117 int alloc; 118 int alloc;
118 int count; 119 int count;
119}; 120};
120 121
121struct cgit_query { 122struct cgit_query {
122 int has_symref; 123 int has_symref;
123 int has_sha1; 124 int has_sha1;
124 char *raw; 125 char *raw;
125 char *repo; 126 char *repo;
126 char *page; 127 char *page;
127 char *search; 128 char *search;
128 char *grep; 129 char *grep;
129 char *head; 130 char *head;
130 char *sha1; 131 char *sha1;
131 char *sha2; 132 char *sha2;
132 char *path; 133 char *path;
133 char *name; 134 char *name;
134 char *mimetype; 135 char *mimetype;
135 char *url; 136 char *url;
136 char *period; 137 char *period;
137 int ofs; 138 int ofs;
138 int nohead; 139 int nohead;
139 char *sort; 140 char *sort;
140 int showmsg; 141 int showmsg;
141}; 142};
142 143
143struct cgit_config { 144struct cgit_config {
144 char *agefile; 145 char *agefile;
145 char *cache_root; 146 char *cache_root;
146 char *clone_prefix; 147 char *clone_prefix;
147 char *css; 148 char *css;
148 char *favicon; 149 char *favicon;
149 char *footer; 150 char *footer;
150 char *head_include; 151 char *head_include;
151 char *header; 152 char *header;
152 char *index_header; 153 char *index_header;
153 char *index_info; 154 char *index_info;
154 char *logo; 155 char *logo;
155 char *logo_link; 156 char *logo_link;
156 char *module_link; 157 char *module_link;
157 char *repo_group; 158 char *repo_group;
158 char *robots; 159 char *robots;
159 char *root_title; 160 char *root_title;
160 char *root_desc; 161 char *root_desc;
161 char *root_readme; 162 char *root_readme;
162 char *script_name; 163 char *script_name;
163 char *virtual_root; 164 char *virtual_root;
164 int cache_size; 165 int cache_size;
165 int cache_dynamic_ttl; 166 int cache_dynamic_ttl;
166 int cache_max_create_time; 167 int cache_max_create_time;
167 int cache_repo_ttl; 168 int cache_repo_ttl;
168 int cache_root_ttl; 169 int cache_root_ttl;
169 int cache_static_ttl; 170 int cache_static_ttl;
170 int embedded; 171 int embedded;
171 int enable_index_links; 172 int enable_index_links;
172 int enable_log_filecount; 173 int enable_log_filecount;
173 int enable_log_linecount; 174 int enable_log_linecount;
174 int local_time; 175 int local_time;
175 int max_repo_count; 176 int max_repo_count;
176 int max_commit_count; 177 int max_commit_count;
177 int max_lock_attempts; 178 int max_lock_attempts;
178 int max_msg_len; 179 int max_msg_len;
179 int max_repodesc_len; 180 int max_repodesc_len;
180 int max_stats; 181 int max_stats;
181 int nocache; 182 int nocache;
182 int noheader; 183 int noheader;
183 int renamelimit; 184 int renamelimit;
184 int snapshots; 185 int snapshots;
185 int summary_branches; 186 int summary_branches;
186 int summary_log; 187 int summary_log;
187 int summary_tags; 188 int summary_tags;
189 struct cgit_filter *about_filter;
188 struct cgit_filter *commit_filter; 190 struct cgit_filter *commit_filter;
189 struct cgit_filter *source_filter; 191 struct cgit_filter *source_filter;
190}; 192};
191 193
192struct cgit_page { 194struct cgit_page {
193 time_t modified; 195 time_t modified;
194 time_t expires; 196 time_t expires;
195 size_t size; 197 size_t size;
196 char *mimetype; 198 char *mimetype;
197 char *charset; 199 char *charset;
198 char *filename; 200 char *filename;
199 char *etag; 201 char *etag;
200 char *title; 202 char *title;
201 int status; 203 int status;
202 char *statusmsg; 204 char *statusmsg;
203}; 205};
204 206
205struct cgit_context { 207struct cgit_context {
206 struct cgit_query qry; 208 struct cgit_query qry;
207 struct cgit_config cfg; 209 struct cgit_config cfg;
208 struct cgit_repo *repo; 210 struct cgit_repo *repo;
209 struct cgit_page page; 211 struct cgit_page page;
210}; 212};
211 213
212struct cgit_snapshot_format { 214struct cgit_snapshot_format {
213 const char *suffix; 215 const char *suffix;
214 const char *mimetype; 216 const char *mimetype;
215 write_archive_fn_t write_func; 217 write_archive_fn_t write_func;
216 int bit; 218 int bit;
217}; 219};
218 220
219extern const char *cgit_version; 221extern const char *cgit_version;
220 222
221extern struct cgit_repolist cgit_repolist; 223extern struct cgit_repolist cgit_repolist;
222extern struct cgit_context ctx; 224extern struct cgit_context ctx;
223extern const struct cgit_snapshot_format cgit_snapshot_formats[]; 225extern const struct cgit_snapshot_format cgit_snapshot_formats[];
224 226
225extern struct cgit_repo *cgit_add_repo(const char *url); 227extern struct cgit_repo *cgit_add_repo(const char *url);
226extern struct cgit_repo *cgit_get_repoinfo(const char *url); 228extern struct cgit_repo *cgit_get_repoinfo(const char *url);
227extern void cgit_repo_config_cb(const char *name, const char *value); 229extern void cgit_repo_config_cb(const char *name, const char *value);
228 230
229extern int chk_zero(int result, char *msg); 231extern int chk_zero(int result, char *msg);
230extern int chk_positive(int result, char *msg); 232extern int chk_positive(int result, char *msg);
231extern int chk_non_negative(int result, char *msg); 233extern int chk_non_negative(int result, char *msg);
232 234
233extern char *trim_end(const char *str, char c); 235extern char *trim_end(const char *str, char c);
234extern char *strlpart(char *txt, int maxlen); 236extern char *strlpart(char *txt, int maxlen);
235extern char *strrpart(char *txt, int maxlen); 237extern char *strrpart(char *txt, int maxlen);
236 238
237extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); 239extern void cgit_add_ref(struct reflist *list, struct refinfo *ref);
238extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, 240extern int cgit_refs_cb(const char *refname, const unsigned char *sha1,
239 int flags, void *cb_data); 241 int flags, void *cb_data);
240 242
241extern void *cgit_free_commitinfo(struct commitinfo *info); 243extern void *cgit_free_commitinfo(struct commitinfo *info);
242 244
243extern int cgit_diff_files(const unsigned char *old_sha1, 245extern int cgit_diff_files(const unsigned char *old_sha1,
244 const unsigned char *new_sha1, 246 const unsigned char *new_sha1,
245 unsigned long *old_size, unsigned long *new_size, 247 unsigned long *old_size, unsigned long *new_size,
246 int *binary, linediff_fn fn); 248 int *binary, linediff_fn fn);
247 249
248extern void cgit_diff_tree(const unsigned char *old_sha1, 250extern void cgit_diff_tree(const unsigned char *old_sha1,
249 const unsigned char *new_sha1, 251 const unsigned char *new_sha1,
250 filepair_fn fn, const char *prefix); 252 filepair_fn fn, const char *prefix);
251 253
252extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); 254extern void cgit_diff_commit(struct commit *commit, filepair_fn fn);
253 255
254extern char *fmt(const char *format,...); 256extern char *fmt(const char *format,...);
255 257
256extern struct commitinfo *cgit_parse_commit(struct commit *commit); 258extern struct commitinfo *cgit_parse_commit(struct commit *commit);
257extern struct taginfo *cgit_parse_tag(struct tag *tag); 259extern struct taginfo *cgit_parse_tag(struct tag *tag);
258extern void cgit_parse_url(const char *url); 260extern void cgit_parse_url(const char *url);
259 261
260extern const char *cgit_repobasename(const char *reponame); 262extern const char *cgit_repobasename(const char *reponame);
261 263
262extern int cgit_parse_snapshots_mask(const char *str); 264extern int cgit_parse_snapshots_mask(const char *str);
263 265
264extern int cgit_open_filter(struct cgit_filter *filter); 266extern int cgit_open_filter(struct cgit_filter *filter);
265extern int cgit_close_filter(struct cgit_filter *filter); 267extern int cgit_close_filter(struct cgit_filter *filter);
266 268
267 269
268#endif /* CGIT_H */ 270#endif /* CGIT_H */