summaryrefslogtreecommitdiffabout
path: root/cgit.h
Unidiff
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 b8af970..42036c3 100644
--- a/cgit.h
+++ b/cgit.h
@@ -1,280 +1,282 @@
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 19
20 20
21/* 21/*
22 * The valid cgit repo-commands 22 * The valid cgit repo-commands
23 */ 23 */
24#define CMD_LOG 1 24#define CMD_LOG 1
25#define CMD_COMMIT 2 25#define CMD_COMMIT 2
26#define CMD_DIFF 3 26#define CMD_DIFF 3
27#define CMD_TREE 4 27#define CMD_TREE 4
28#define CMD_BLOB 5 28#define CMD_BLOB 5
29#define CMD_SNAPSHOT 6 29#define CMD_SNAPSHOT 6
30#define CMD_TAG 7 30#define CMD_TAG 7
31#define CMD_REFS 8 31#define CMD_REFS 8
32 32
33/* 33/*
34 * Dateformats used on misc. pages 34 * Dateformats used on misc. pages
35 */ 35 */
36#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S" 36#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S"
37#define FMT_SHORTDATE "%Y-%m-%d" 37#define FMT_SHORTDATE "%Y-%m-%d"
38 38
39 39
40/* 40/*
41 * Limits used for relative dates 41 * Limits used for relative dates
42 */ 42 */
43#define TM_MIN 60 43#define TM_MIN 60
44#define TM_HOUR (TM_MIN * 60) 44#define TM_HOUR (TM_MIN * 60)
45#define TM_DAY (TM_HOUR * 24) 45#define TM_DAY (TM_HOUR * 24)
46#define TM_WEEK (TM_DAY * 7) 46#define TM_WEEK (TM_DAY * 7)
47#define TM_YEAR (TM_DAY * 365) 47#define TM_YEAR (TM_DAY * 365)
48#define TM_MONTH (TM_YEAR / 12.0) 48#define TM_MONTH (TM_YEAR / 12.0)
49 49
50 50
51typedef void (*configfn)(const char *name, const char *value); 51typedef void (*configfn)(const char *name, const char *value);
52typedef void (*filepair_fn)(struct diff_filepair *pair); 52typedef void (*filepair_fn)(struct diff_filepair *pair);
53typedef void (*linediff_fn)(char *line, int len); 53typedef void (*linediff_fn)(char *line, int len);
54 54
55struct cacheitem { 55struct cacheitem {
56 char *name; 56 char *name;
57 struct stat st; 57 struct stat st;
58 int ttl; 58 int ttl;
59 int fd; 59 int fd;
60}; 60};
61 61
62struct repoinfo { 62struct repoinfo {
63 char *url; 63 char *url;
64 char *name; 64 char *name;
65 char *path; 65 char *path;
66 char *desc; 66 char *desc;
67 char *owner; 67 char *owner;
68 char *defbranch; 68 char *defbranch;
69 char *group; 69 char *group;
70 char *module_link; 70 char *module_link;
71 char *readme; 71 char *readme;
72 int snapshots; 72 int snapshots;
73 int enable_log_filecount; 73 int enable_log_filecount;
74 int enable_log_linecount; 74 int enable_log_linecount;
75}; 75};
76 76
77struct repolist { 77struct repolist {
78 int length; 78 int length;
79 int count; 79 int count;
80 struct repoinfo *repos; 80 struct repoinfo *repos;
81}; 81};
82 82
83struct commitinfo { 83struct commitinfo {
84 struct commit *commit; 84 struct commit *commit;
85 char *author; 85 char *author;
86 char *author_email; 86 char *author_email;
87 unsigned long author_date; 87 unsigned long author_date;
88 char *committer; 88 char *committer;
89 char *committer_email; 89 char *committer_email;
90 unsigned long committer_date; 90 unsigned long committer_date;
91 char *subject; 91 char *subject;
92 char *msg; 92 char *msg;
93}; 93};
94 94
95struct taginfo { 95struct taginfo {
96 char *tagger; 96 char *tagger;
97 char *tagger_email; 97 char *tagger_email;
98 int tagger_date; 98 int tagger_date;
99 char *msg; 99 char *msg;
100}; 100};
101 101
102struct refinfo { 102struct refinfo {
103 const char *refname; 103 const char *refname;
104 struct object *object; 104 struct object *object;
105 union { 105 union {
106 struct taginfo *tag; 106 struct taginfo *tag;
107 struct commitinfo *commit; 107 struct commitinfo *commit;
108 }; 108 };
109}; 109};
110 110
111struct reflist { 111struct reflist {
112 struct refinfo **refs; 112 struct refinfo **refs;
113 int alloc; 113 int alloc;
114 int count; 114 int count;
115}; 115};
116 116
117extern const char *cgit_version; 117extern const char *cgit_version;
118 118
119extern struct repolist cgit_repolist; 119extern struct repolist cgit_repolist;
120extern struct repoinfo *cgit_repo; 120extern struct repoinfo *cgit_repo;
121extern int cgit_cmd; 121extern int cgit_cmd;
122 122
123extern char *cgit_root_title; 123extern char *cgit_root_title;
124extern char *cgit_css; 124extern char *cgit_css;
125extern char *cgit_logo; 125extern char *cgit_logo;
126extern char *cgit_index_header; 126extern char *cgit_index_header;
127extern char *cgit_index_info; 127extern char *cgit_index_info;
128extern char *cgit_logo_link; 128extern char *cgit_logo_link;
129extern char *cgit_module_link; 129extern char *cgit_module_link;
130extern char *cgit_agefile; 130extern char *cgit_agefile;
131extern char *cgit_virtual_root; 131extern char *cgit_virtual_root;
132extern char *cgit_script_name; 132extern char *cgit_script_name;
133extern char *cgit_cache_root; 133extern char *cgit_cache_root;
134extern char *cgit_repo_group; 134extern char *cgit_repo_group;
135 135
136extern int cgit_nocache; 136extern int cgit_nocache;
137extern int cgit_snapshots; 137extern int cgit_snapshots;
138extern int cgit_enable_index_links; 138extern int cgit_enable_index_links;
139extern int cgit_enable_log_filecount; 139extern int cgit_enable_log_filecount;
140extern int cgit_enable_log_linecount; 140extern int cgit_enable_log_linecount;
141extern int cgit_max_lock_attempts; 141extern int cgit_max_lock_attempts;
142extern int cgit_cache_root_ttl; 142extern int cgit_cache_root_ttl;
143extern int cgit_cache_repo_ttl; 143extern int cgit_cache_repo_ttl;
144extern int cgit_cache_dynamic_ttl; 144extern int cgit_cache_dynamic_ttl;
145extern int cgit_cache_static_ttl; 145extern int cgit_cache_static_ttl;
146extern int cgit_cache_max_create_time; 146extern int cgit_cache_max_create_time;
147extern int cgit_summary_log; 147extern int cgit_summary_log;
148extern int cgit_summary_tags; 148extern int cgit_summary_tags;
149extern int cgit_summary_branches; 149extern int cgit_summary_branches;
150 150
151extern int cgit_max_msg_len; 151extern int cgit_max_msg_len;
152extern int cgit_max_repodesc_len; 152extern int cgit_max_repodesc_len;
153extern int cgit_max_commit_count; 153extern int cgit_max_commit_count;
154 154
155extern int cgit_query_has_symref; 155extern int cgit_query_has_symref;
156extern int cgit_query_has_sha1; 156extern int cgit_query_has_sha1;
157 157
158extern char *cgit_querystring; 158extern char *cgit_querystring;
159extern char *cgit_query_repo; 159extern char *cgit_query_repo;
160extern char *cgit_query_page; 160extern char *cgit_query_page;
161extern char *cgit_query_search; 161extern char *cgit_query_search;
162extern char *cgit_query_grep; 162extern char *cgit_query_grep;
163extern char *cgit_query_head; 163extern char *cgit_query_head;
164extern char *cgit_query_sha1; 164extern char *cgit_query_sha1;
165extern char *cgit_query_sha2; 165extern char *cgit_query_sha2;
166extern char *cgit_query_path; 166extern char *cgit_query_path;
167extern char *cgit_query_name; 167extern char *cgit_query_name;
168extern int cgit_query_ofs; 168extern int cgit_query_ofs;
169 169
170extern int htmlfd; 170extern int htmlfd;
171 171
172extern int cgit_get_cmd_index(const char *cmd); 172extern int cgit_get_cmd_index(const char *cmd);
173extern struct repoinfo *cgit_get_repoinfo(const char *url); 173extern struct repoinfo *cgit_get_repoinfo(const char *url);
174extern void cgit_global_config_cb(const char *name, const char *value); 174extern void cgit_global_config_cb(const char *name, const char *value);
175extern void cgit_repo_config_cb(const char *name, const char *value); 175extern void cgit_repo_config_cb(const char *name, const char *value);
176extern void cgit_querystring_cb(const char *name, const char *value); 176extern void cgit_querystring_cb(const char *name, const char *value);
177 177
178extern int chk_zero(int result, char *msg); 178extern int chk_zero(int result, char *msg);
179extern int chk_positive(int result, char *msg); 179extern int chk_positive(int result, char *msg);
180extern int chk_non_negative(int result, char *msg); 180extern int chk_non_negative(int result, char *msg);
181 181
182extern int hextoint(char c); 182extern int hextoint(char c);
183extern char *trim_end(const char *str, char c); 183extern char *trim_end(const char *str, char c);
184extern char *strlpart(char *txt, int maxlen);
185extern char *strrpart(char *txt, int maxlen);
184 186
185extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); 187extern void cgit_add_ref(struct reflist *list, struct refinfo *ref);
186extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, 188extern int cgit_refs_cb(const char *refname, const unsigned char *sha1,
187 int flags, void *cb_data); 189 int flags, void *cb_data);
188 190
189extern void *cgit_free_commitinfo(struct commitinfo *info); 191extern void *cgit_free_commitinfo(struct commitinfo *info);
190 192
191extern int cgit_diff_files(const unsigned char *old_sha1, 193extern int cgit_diff_files(const unsigned char *old_sha1,
192 const unsigned char *new_sha1, 194 const unsigned char *new_sha1,
193 linediff_fn fn); 195 linediff_fn fn);
194 196
195extern void cgit_diff_tree(const unsigned char *old_sha1, 197extern void cgit_diff_tree(const unsigned char *old_sha1,
196 const unsigned char *new_sha1, 198 const unsigned char *new_sha1,
197 filepair_fn fn, const char *prefix); 199 filepair_fn fn, const char *prefix);
198 200
199extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); 201extern void cgit_diff_commit(struct commit *commit, filepair_fn fn);
200 202
201extern char *fmt(const char *format,...); 203extern char *fmt(const char *format,...);
202 204
203extern void html(const char *txt); 205extern void html(const char *txt);
204extern void htmlf(const char *format,...); 206extern void htmlf(const char *format,...);
205extern void html_txt(char *txt); 207extern void html_txt(char *txt);
206extern void html_ntxt(int len, char *txt); 208extern void html_ntxt(int len, char *txt);
207extern void html_attr(char *txt); 209extern void html_attr(char *txt);
208extern void html_hidden(char *name, char *value); 210extern void html_hidden(char *name, char *value);
209extern void html_option(char *value, char *text, char *selected_value); 211extern void html_option(char *value, char *text, char *selected_value);
210extern void html_link_open(char *url, char *title, char *class); 212extern void html_link_open(char *url, char *title, char *class);
211extern void html_link_close(void); 213extern void html_link_close(void);
212extern void html_filemode(unsigned short mode); 214extern void html_filemode(unsigned short mode);
213extern int html_include(const char *filename); 215extern int html_include(const char *filename);
214 216
215extern int cgit_read_config(const char *filename, configfn fn); 217extern int cgit_read_config(const char *filename, configfn fn);
216extern int cgit_parse_query(char *txt, configfn fn); 218extern int cgit_parse_query(char *txt, configfn fn);
217extern struct commitinfo *cgit_parse_commit(struct commit *commit); 219extern struct commitinfo *cgit_parse_commit(struct commit *commit);
218extern struct taginfo *cgit_parse_tag(struct tag *tag); 220extern struct taginfo *cgit_parse_tag(struct tag *tag);
219extern void cgit_parse_url(const char *url); 221extern void cgit_parse_url(const char *url);
220 222
221extern char *cache_safe_filename(const char *unsafe); 223extern char *cache_safe_filename(const char *unsafe);
222extern int cache_lock(struct cacheitem *item); 224extern int cache_lock(struct cacheitem *item);
223extern int cache_unlock(struct cacheitem *item); 225extern int cache_unlock(struct cacheitem *item);
224extern int cache_cancel_lock(struct cacheitem *item); 226extern int cache_cancel_lock(struct cacheitem *item);
225extern int cache_exist(struct cacheitem *item); 227extern int cache_exist(struct cacheitem *item);
226extern int cache_expired(struct cacheitem *item); 228extern int cache_expired(struct cacheitem *item);
227 229
228extern char *cgit_repourl(const char *reponame); 230extern char *cgit_repourl(const char *reponame);
229extern char *cgit_fileurl(const char *reponame, const char *pagename, 231extern char *cgit_fileurl(const char *reponame, const char *pagename,
230 const char *filename, const char *query); 232 const char *filename, const char *query);
231extern char *cgit_pageurl(const char *reponame, const char *pagename, 233extern char *cgit_pageurl(const char *reponame, const char *pagename,
232 const char *query); 234 const char *query);
233 235
234extern const char *cgit_repobasename(const char *reponame); 236extern const char *cgit_repobasename(const char *reponame);
235 237
236extern void cgit_tree_link(char *name, char *title, char *class, char *head, 238extern void cgit_tree_link(char *name, char *title, char *class, char *head,
237 char *rev, char *path); 239 char *rev, char *path);
238extern void cgit_log_link(char *name, char *title, char *class, char *head, 240extern void cgit_log_link(char *name, char *title, char *class, char *head,
239 char *rev, char *path, int ofs); 241 char *rev, char *path, int ofs);
240extern void cgit_commit_link(char *name, char *title, char *class, char *head, 242extern void cgit_commit_link(char *name, char *title, char *class, char *head,
241 char *rev); 243 char *rev);
242extern void cgit_refs_link(char *name, char *title, char *class, char *head, 244extern void cgit_refs_link(char *name, char *title, char *class, char *head,
243 char *rev, char *path); 245 char *rev, char *path);
244extern void cgit_snapshot_link(char *name, char *title, char *class, 246extern void cgit_snapshot_link(char *name, char *title, char *class,
245 char *head, char *rev, char *archivename); 247 char *head, char *rev, char *archivename);
246extern void cgit_diff_link(char *name, char *title, char *class, char *head, 248extern void cgit_diff_link(char *name, char *title, char *class, char *head,
247 char *new_rev, char *old_rev, char *path); 249 char *new_rev, char *old_rev, char *path);
248 250
249extern void cgit_object_link(struct object *obj); 251extern void cgit_object_link(struct object *obj);
250 252
251extern void cgit_print_error(char *msg); 253extern void cgit_print_error(char *msg);
252extern void cgit_print_date(time_t secs, char *format); 254extern void cgit_print_date(time_t secs, char *format);
253extern void cgit_print_age(time_t t, time_t max_relative, char *format); 255extern void cgit_print_age(time_t t, time_t max_relative, char *format);
254extern void cgit_print_docstart(char *title, struct cacheitem *item); 256extern void cgit_print_docstart(char *title, struct cacheitem *item);
255extern void cgit_print_docend(); 257extern void cgit_print_docend();
256extern void cgit_print_pageheader(char *title, int show_search); 258extern void cgit_print_pageheader(char *title, int show_search);
257extern void cgit_print_snapshot_start(const char *mimetype, 259extern void cgit_print_snapshot_start(const char *mimetype,
258 const char *filename, 260 const char *filename,
259 struct cacheitem *item); 261 struct cacheitem *item);
260extern void cgit_print_branches(int maxcount); 262extern void cgit_print_branches(int maxcount);
261extern void cgit_print_tags(int maxcount); 263extern void cgit_print_tags(int maxcount);
262 264
263extern void cgit_print_repolist(struct cacheitem *item); 265extern void cgit_print_repolist(struct cacheitem *item);
264extern void cgit_print_summary(); 266extern void cgit_print_summary();
265extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, 267extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep,
266 char *pattern, char *path, int pager); 268 char *pattern, char *path, int pager);
267extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); 269extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
268extern void cgit_print_tree(const char *rev, char *path); 270extern void cgit_print_tree(const char *rev, char *path);
269extern void cgit_print_commit(char *hex); 271extern void cgit_print_commit(char *hex);
270extern void cgit_print_refs(); 272extern void cgit_print_refs();
271extern void cgit_print_tag(char *revname); 273extern void cgit_print_tag(char *revname);
272extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix); 274extern void cgit_print_diff(const char *new_hex, const char *old_hex, const char *prefix);
273extern void cgit_print_snapshot(struct cacheitem *item, const char *head, 275extern void cgit_print_snapshot(struct cacheitem *item, const char *head,
274 const char *hex, const char *prefix, 276 const char *hex, const char *prefix,
275 const char *filename, int snapshot); 277 const char *filename, int snapshot);
276extern void cgit_print_snapshot_links(const char *repo, const char *head, 278extern void cgit_print_snapshot_links(const char *repo, const char *head,
277 const char *hex, int snapshots); 279 const char *hex, int snapshots);
278extern int cgit_parse_snapshots_mask(const char *str); 280extern int cgit_parse_snapshots_mask(const char *str);
279 281
280#endif /* CGIT_H */ 282#endif /* CGIT_H */