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, 0 insertions, 1 deletions
diff --git a/cgit.h b/cgit.h
index b58676b..e82e9aa 100644
--- a/cgit.h
+++ b/cgit.h
@@ -1,242 +1,241 @@
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/xdiff.h> 18#include <xdiff/xdiff.h>
19#include <utf8.h> 19#include <utf8.h>
20 20
21 21
22/* 22/*
23 * Dateformats used on misc. pages 23 * Dateformats used on misc. pages
24 */ 24 */
25#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S" 25#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S"
26#define FMT_SHORTDATE "%Y-%m-%d" 26#define FMT_SHORTDATE "%Y-%m-%d"
27 27
28 28
29/* 29/*
30 * Limits used for relative dates 30 * Limits used for relative dates
31 */ 31 */
32#define TM_MIN 60 32#define TM_MIN 60
33#define TM_HOUR (TM_MIN * 60) 33#define TM_HOUR (TM_MIN * 60)
34#define TM_DAY (TM_HOUR * 24) 34#define TM_DAY (TM_HOUR * 24)
35#define TM_WEEK (TM_DAY * 7) 35#define TM_WEEK (TM_DAY * 7)
36#define TM_YEAR (TM_DAY * 365) 36#define TM_YEAR (TM_DAY * 365)
37#define TM_MONTH (TM_YEAR / 12.0) 37#define TM_MONTH (TM_YEAR / 12.0)
38 38
39 39
40/* 40/*
41 * Default encoding 41 * Default encoding
42 */ 42 */
43#define PAGE_ENCODING "UTF-8" 43#define PAGE_ENCODING "UTF-8"
44 44
45typedef void (*configfn)(const char *name, const char *value); 45typedef void (*configfn)(const char *name, const char *value);
46typedef void (*filepair_fn)(struct diff_filepair *pair); 46typedef void (*filepair_fn)(struct diff_filepair *pair);
47typedef void (*linediff_fn)(char *line, int len); 47typedef void (*linediff_fn)(char *line, int len);
48 48
49struct cacheitem { 49struct cacheitem {
50 char *name; 50 char *name;
51 struct stat st; 51 struct stat st;
52 int ttl; 52 int ttl;
53 int fd; 53 int fd;
54}; 54};
55 55
56struct cgit_repo { 56struct cgit_repo {
57 char *url; 57 char *url;
58 char *name; 58 char *name;
59 char *path; 59 char *path;
60 char *desc; 60 char *desc;
61 char *owner; 61 char *owner;
62 char *defbranch; 62 char *defbranch;
63 char *group; 63 char *group;
64 char *module_link; 64 char *module_link;
65 char *readme; 65 char *readme;
66 char *clone_url; 66 char *clone_url;
67 int snapshots; 67 int snapshots;
68 int enable_log_filecount; 68 int enable_log_filecount;
69 int enable_log_linecount; 69 int enable_log_linecount;
70}; 70};
71 71
72struct cgit_repolist { 72struct cgit_repolist {
73 int length; 73 int length;
74 int count; 74 int count;
75 struct cgit_repo *repos; 75 struct cgit_repo *repos;
76}; 76};
77 77
78struct commitinfo { 78struct commitinfo {
79 struct commit *commit; 79 struct commit *commit;
80 char *author; 80 char *author;
81 char *author_email; 81 char *author_email;
82 unsigned long author_date; 82 unsigned long author_date;
83 char *committer; 83 char *committer;
84 char *committer_email; 84 char *committer_email;
85 unsigned long committer_date; 85 unsigned long committer_date;
86 char *subject; 86 char *subject;
87 char *msg; 87 char *msg;
88 char *msg_encoding; 88 char *msg_encoding;
89}; 89};
90 90
91struct taginfo { 91struct taginfo {
92 char *tagger; 92 char *tagger;
93 char *tagger_email; 93 char *tagger_email;
94 int tagger_date; 94 int tagger_date;
95 char *msg; 95 char *msg;
96}; 96};
97 97
98struct refinfo { 98struct refinfo {
99 const char *refname; 99 const char *refname;
100 struct object *object; 100 struct object *object;
101 union { 101 union {
102 struct taginfo *tag; 102 struct taginfo *tag;
103 struct commitinfo *commit; 103 struct commitinfo *commit;
104 }; 104 };
105}; 105};
106 106
107struct reflist { 107struct reflist {
108 struct refinfo **refs; 108 struct refinfo **refs;
109 int alloc; 109 int alloc;
110 int count; 110 int count;
111}; 111};
112 112
113struct cgit_query { 113struct cgit_query {
114 int has_symref; 114 int has_symref;
115 int has_sha1; 115 int has_sha1;
116 char *raw; 116 char *raw;
117 char *repo; 117 char *repo;
118 char *page; 118 char *page;
119 char *search; 119 char *search;
120 char *grep; 120 char *grep;
121 char *head; 121 char *head;
122 char *sha1; 122 char *sha1;
123 char *sha2; 123 char *sha2;
124 char *path; 124 char *path;
125 char *name; 125 char *name;
126 int ofs; 126 int ofs;
127}; 127};
128 128
129struct cgit_config { 129struct cgit_config {
130 char *agefile; 130 char *agefile;
131 char *cache_root; 131 char *cache_root;
132 char *clone_prefix; 132 char *clone_prefix;
133 char *css; 133 char *css;
134 char *index_header; 134 char *index_header;
135 char *index_info; 135 char *index_info;
136 char *logo; 136 char *logo;
137 char *logo_link; 137 char *logo_link;
138 char *module_link; 138 char *module_link;
139 char *repo_group; 139 char *repo_group;
140 char *robots; 140 char *robots;
141 char *root_title; 141 char *root_title;
142 char *script_name; 142 char *script_name;
143 char *virtual_root; 143 char *virtual_root;
144 int cache_dynamic_ttl; 144 int cache_dynamic_ttl;
145 int cache_max_create_time; 145 int cache_max_create_time;
146 int cache_repo_ttl; 146 int cache_repo_ttl;
147 int cache_root_ttl; 147 int cache_root_ttl;
148 int cache_static_ttl; 148 int cache_static_ttl;
149 int enable_index_links; 149 int enable_index_links;
150 int enable_log_filecount; 150 int enable_log_filecount;
151 int enable_log_linecount; 151 int enable_log_linecount;
152 int max_commit_count; 152 int max_commit_count;
153 int max_lock_attempts; 153 int max_lock_attempts;
154 int max_msg_len; 154 int max_msg_len;
155 int max_repodesc_len; 155 int max_repodesc_len;
156 int nocache; 156 int nocache;
157 int renamelimit; 157 int renamelimit;
158 int snapshots; 158 int snapshots;
159 int summary_branches; 159 int summary_branches;
160 int summary_log; 160 int summary_log;
161 int summary_tags; 161 int summary_tags;
162}; 162};
163 163
164struct cgit_page { 164struct cgit_page {
165 time_t modified; 165 time_t modified;
166 time_t expires; 166 time_t expires;
167 char *mimetype; 167 char *mimetype;
168 char *charset; 168 char *charset;
169 char *filename; 169 char *filename;
170 char *title; 170 char *title;
171}; 171};
172 172
173struct cgit_context { 173struct cgit_context {
174 struct cgit_query qry; 174 struct cgit_query qry;
175 struct cgit_config cfg; 175 struct cgit_config cfg;
176 struct cgit_repo *repo; 176 struct cgit_repo *repo;
177 struct cgit_page page; 177 struct cgit_page page;
178}; 178};
179 179
180struct cgit_snapshot_format { 180struct cgit_snapshot_format {
181 const char *suffix; 181 const char *suffix;
182 const char *mimetype; 182 const char *mimetype;
183 write_archive_fn_t write_func; 183 write_archive_fn_t write_func;
184 int bit; 184 int bit;
185}; 185};
186 186
187extern const char *cgit_version; 187extern const char *cgit_version;
188 188
189extern struct cgit_repolist cgit_repolist; 189extern struct cgit_repolist cgit_repolist;
190extern struct cgit_context ctx; 190extern struct cgit_context ctx;
191extern const struct cgit_snapshot_format cgit_snapshot_formats[]; 191extern const struct cgit_snapshot_format cgit_snapshot_formats[];
192extern int cgit_cmd;
193 192
194extern struct cgit_repo *cgit_add_repo(const char *url); 193extern struct cgit_repo *cgit_add_repo(const char *url);
195extern struct cgit_repo *cgit_get_repoinfo(const char *url); 194extern struct cgit_repo *cgit_get_repoinfo(const char *url);
196extern void cgit_repo_config_cb(const char *name, const char *value); 195extern void cgit_repo_config_cb(const char *name, const char *value);
197 196
198extern int chk_zero(int result, char *msg); 197extern int chk_zero(int result, char *msg);
199extern int chk_positive(int result, char *msg); 198extern int chk_positive(int result, char *msg);
200extern int chk_non_negative(int result, char *msg); 199extern int chk_non_negative(int result, char *msg);
201 200
202extern int hextoint(char c); 201extern int hextoint(char c);
203extern char *trim_end(const char *str, char c); 202extern char *trim_end(const char *str, char c);
204extern char *strlpart(char *txt, int maxlen); 203extern char *strlpart(char *txt, int maxlen);
205extern char *strrpart(char *txt, int maxlen); 204extern char *strrpart(char *txt, int maxlen);
206 205
207extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); 206extern void cgit_add_ref(struct reflist *list, struct refinfo *ref);
208extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, 207extern int cgit_refs_cb(const char *refname, const unsigned char *sha1,
209 int flags, void *cb_data); 208 int flags, void *cb_data);
210 209
211extern void *cgit_free_commitinfo(struct commitinfo *info); 210extern void *cgit_free_commitinfo(struct commitinfo *info);
212 211
213extern int cgit_diff_files(const unsigned char *old_sha1, 212extern int cgit_diff_files(const unsigned char *old_sha1,
214 const unsigned char *new_sha1, 213 const unsigned char *new_sha1,
215 linediff_fn fn); 214 linediff_fn fn);
216 215
217extern void cgit_diff_tree(const unsigned char *old_sha1, 216extern void cgit_diff_tree(const unsigned char *old_sha1,
218 const unsigned char *new_sha1, 217 const unsigned char *new_sha1,
219 filepair_fn fn, const char *prefix); 218 filepair_fn fn, const char *prefix);
220 219
221extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); 220extern void cgit_diff_commit(struct commit *commit, filepair_fn fn);
222 221
223extern char *fmt(const char *format,...); 222extern char *fmt(const char *format,...);
224 223
225extern int cgit_read_config(const char *filename, configfn fn); 224extern int cgit_read_config(const char *filename, configfn fn);
226extern int cgit_parse_query(char *txt, configfn fn); 225extern int cgit_parse_query(char *txt, configfn fn);
227extern struct commitinfo *cgit_parse_commit(struct commit *commit); 226extern struct commitinfo *cgit_parse_commit(struct commit *commit);
228extern struct taginfo *cgit_parse_tag(struct tag *tag); 227extern struct taginfo *cgit_parse_tag(struct tag *tag);
229extern void cgit_parse_url(const char *url); 228extern void cgit_parse_url(const char *url);
230 229
231extern char *cache_safe_filename(const char *unsafe); 230extern char *cache_safe_filename(const char *unsafe);
232extern int cache_lock(struct cacheitem *item); 231extern int cache_lock(struct cacheitem *item);
233extern int cache_unlock(struct cacheitem *item); 232extern int cache_unlock(struct cacheitem *item);
234extern int cache_cancel_lock(struct cacheitem *item); 233extern int cache_cancel_lock(struct cacheitem *item);
235extern int cache_exist(struct cacheitem *item); 234extern int cache_exist(struct cacheitem *item);
236extern int cache_expired(struct cacheitem *item); 235extern int cache_expired(struct cacheitem *item);
237 236
238extern const char *cgit_repobasename(const char *reponame); 237extern const char *cgit_repobasename(const char *reponame);
239 238
240extern int cgit_parse_snapshots_mask(const char *str); 239extern int cgit_parse_snapshots_mask(const char *str);
241 240
242#endif /* CGIT_H */ 241#endif /* CGIT_H */