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 e0879bd..8927236 100644
--- a/cgit.h
+++ b/cgit.h
@@ -1,203 +1,205 @@
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_VIEW 5 28#define CMD_VIEW 5
29#define CMD_BLOB 6 29#define CMD_BLOB 6
30#define CMD_SNAPSHOT 7 30#define CMD_SNAPSHOT 7
31 31
32typedef void (*configfn)(const char *name, const char *value); 32typedef void (*configfn)(const char *name, const char *value);
33typedef void (*filepair_fn)(struct diff_filepair *pair); 33typedef void (*filepair_fn)(struct diff_filepair *pair);
34typedef void (*linediff_fn)(char *line, int len); 34typedef void (*linediff_fn)(char *line, int len);
35 35
36struct cacheitem { 36struct cacheitem {
37 char *name; 37 char *name;
38 struct stat st; 38 struct stat st;
39 int ttl; 39 int ttl;
40 int fd; 40 int fd;
41}; 41};
42 42
43struct repoinfo { 43struct repoinfo {
44 char *url; 44 char *url;
45 char *name; 45 char *name;
46 char *path; 46 char *path;
47 char *desc; 47 char *desc;
48 char *owner; 48 char *owner;
49 char *defbranch; 49 char *defbranch;
50 char *group;
50 char *module_link; 51 char *module_link;
51 int snapshots; 52 int snapshots;
52 int enable_log_filecount; 53 int enable_log_filecount;
53 int enable_log_linecount; 54 int enable_log_linecount;
54}; 55};
55 56
56struct repolist { 57struct repolist {
57 int length; 58 int length;
58 int count; 59 int count;
59 struct repoinfo *repos; 60 struct repoinfo *repos;
60}; 61};
61 62
62struct commitinfo { 63struct commitinfo {
63 struct commit *commit; 64 struct commit *commit;
64 char *author; 65 char *author;
65 char *author_email; 66 char *author_email;
66 unsigned long author_date; 67 unsigned long author_date;
67 char *committer; 68 char *committer;
68 char *committer_email; 69 char *committer_email;
69 unsigned long committer_date; 70 unsigned long committer_date;
70 char *subject; 71 char *subject;
71 char *msg; 72 char *msg;
72}; 73};
73 74
74struct taginfo { 75struct taginfo {
75 char *tagger; 76 char *tagger;
76 char *tagger_email; 77 char *tagger_email;
77 int tagger_date; 78 int tagger_date;
78 char *msg; 79 char *msg;
79}; 80};
80 81
81extern const char cgit_version[]; 82extern const char cgit_version[];
82 83
83extern struct repolist cgit_repolist; 84extern struct repolist cgit_repolist;
84extern struct repoinfo *cgit_repo; 85extern struct repoinfo *cgit_repo;
85extern int cgit_cmd; 86extern int cgit_cmd;
86 87
87extern char *cgit_root_title; 88extern char *cgit_root_title;
88extern char *cgit_css; 89extern char *cgit_css;
89extern char *cgit_logo; 90extern char *cgit_logo;
90extern char *cgit_index_header; 91extern char *cgit_index_header;
91extern char *cgit_logo_link; 92extern char *cgit_logo_link;
92extern char *cgit_module_link; 93extern char *cgit_module_link;
93extern char *cgit_virtual_root; 94extern char *cgit_virtual_root;
94extern char *cgit_script_name; 95extern char *cgit_script_name;
95extern char *cgit_cache_root; 96extern char *cgit_cache_root;
97extern char *cgit_repo_group;
96 98
97extern int cgit_nocache; 99extern int cgit_nocache;
98extern int cgit_snapshots; 100extern int cgit_snapshots;
99extern int cgit_enable_log_filecount; 101extern int cgit_enable_log_filecount;
100extern int cgit_enable_log_linecount; 102extern int cgit_enable_log_linecount;
101extern int cgit_max_lock_attempts; 103extern int cgit_max_lock_attempts;
102extern int cgit_cache_root_ttl; 104extern int cgit_cache_root_ttl;
103extern int cgit_cache_repo_ttl; 105extern int cgit_cache_repo_ttl;
104extern int cgit_cache_dynamic_ttl; 106extern int cgit_cache_dynamic_ttl;
105extern int cgit_cache_static_ttl; 107extern int cgit_cache_static_ttl;
106extern int cgit_cache_max_create_time; 108extern int cgit_cache_max_create_time;
107 109
108extern int cgit_max_msg_len; 110extern int cgit_max_msg_len;
109extern int cgit_max_repodesc_len; 111extern int cgit_max_repodesc_len;
110extern int cgit_max_commit_count; 112extern int cgit_max_commit_count;
111 113
112extern int cgit_query_has_symref; 114extern int cgit_query_has_symref;
113extern int cgit_query_has_sha1; 115extern int cgit_query_has_sha1;
114 116
115extern char *cgit_querystring; 117extern char *cgit_querystring;
116extern char *cgit_query_repo; 118extern char *cgit_query_repo;
117extern char *cgit_query_page; 119extern char *cgit_query_page;
118extern char *cgit_query_search; 120extern char *cgit_query_search;
119extern char *cgit_query_head; 121extern char *cgit_query_head;
120extern char *cgit_query_sha1; 122extern char *cgit_query_sha1;
121extern char *cgit_query_sha2; 123extern char *cgit_query_sha2;
122extern char *cgit_query_path; 124extern char *cgit_query_path;
123extern char *cgit_query_name; 125extern char *cgit_query_name;
124extern int cgit_query_ofs; 126extern int cgit_query_ofs;
125 127
126extern int htmlfd; 128extern int htmlfd;
127 129
128extern int cgit_get_cmd_index(const char *cmd); 130extern int cgit_get_cmd_index(const char *cmd);
129extern struct repoinfo *cgit_get_repoinfo(const char *url); 131extern struct repoinfo *cgit_get_repoinfo(const char *url);
130extern void cgit_global_config_cb(const char *name, const char *value); 132extern void cgit_global_config_cb(const char *name, const char *value);
131extern void cgit_repo_config_cb(const char *name, const char *value); 133extern void cgit_repo_config_cb(const char *name, const char *value);
132extern void cgit_querystring_cb(const char *name, const char *value); 134extern void cgit_querystring_cb(const char *name, const char *value);
133 135
134extern int chk_zero(int result, char *msg); 136extern int chk_zero(int result, char *msg);
135extern int chk_positive(int result, char *msg); 137extern int chk_positive(int result, char *msg);
136 138
137extern int hextoint(char c); 139extern int hextoint(char c);
138 140
139extern void *cgit_free_commitinfo(struct commitinfo *info); 141extern void *cgit_free_commitinfo(struct commitinfo *info);
140 142
141extern int cgit_diff_files(const unsigned char *old_sha1, 143extern int cgit_diff_files(const unsigned char *old_sha1,
142 const unsigned char *new_sha1, 144 const unsigned char *new_sha1,
143 linediff_fn fn); 145 linediff_fn fn);
144 146
145extern void cgit_diff_tree(const unsigned char *old_sha1, 147extern void cgit_diff_tree(const unsigned char *old_sha1,
146 const unsigned char *new_sha1, 148 const unsigned char *new_sha1,
147 filepair_fn fn); 149 filepair_fn fn);
148 150
149extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); 151extern void cgit_diff_commit(struct commit *commit, filepair_fn fn);
150 152
151extern char *fmt(const char *format,...); 153extern char *fmt(const char *format,...);
152 154
153extern void html(const char *txt); 155extern void html(const char *txt);
154extern void htmlf(const char *format,...); 156extern void htmlf(const char *format,...);
155extern void html_txt(char *txt); 157extern void html_txt(char *txt);
156extern void html_ntxt(int len, char *txt); 158extern void html_ntxt(int len, char *txt);
157extern void html_attr(char *txt); 159extern void html_attr(char *txt);
158extern void html_hidden(char *name, char *value); 160extern void html_hidden(char *name, char *value);
159extern void html_link_open(char *url, char *title, char *class); 161extern void html_link_open(char *url, char *title, char *class);
160extern void html_link_close(void); 162extern void html_link_close(void);
161extern void html_filemode(unsigned short mode); 163extern void html_filemode(unsigned short mode);
162extern int html_include(const char *filename); 164extern int html_include(const char *filename);
163 165
164extern int cgit_read_config(const char *filename, configfn fn); 166extern int cgit_read_config(const char *filename, configfn fn);
165extern int cgit_parse_query(char *txt, configfn fn); 167extern int cgit_parse_query(char *txt, configfn fn);
166extern struct commitinfo *cgit_parse_commit(struct commit *commit); 168extern struct commitinfo *cgit_parse_commit(struct commit *commit);
167extern struct taginfo *cgit_parse_tag(struct tag *tag); 169extern struct taginfo *cgit_parse_tag(struct tag *tag);
168extern void cgit_parse_url(const char *url); 170extern void cgit_parse_url(const char *url);
169 171
170extern char *cache_safe_filename(const char *unsafe); 172extern char *cache_safe_filename(const char *unsafe);
171extern int cache_lock(struct cacheitem *item); 173extern int cache_lock(struct cacheitem *item);
172extern int cache_unlock(struct cacheitem *item); 174extern int cache_unlock(struct cacheitem *item);
173extern int cache_cancel_lock(struct cacheitem *item); 175extern int cache_cancel_lock(struct cacheitem *item);
174extern int cache_exist(struct cacheitem *item); 176extern int cache_exist(struct cacheitem *item);
175extern int cache_expired(struct cacheitem *item); 177extern int cache_expired(struct cacheitem *item);
176 178
177extern char *cgit_repourl(const char *reponame); 179extern char *cgit_repourl(const char *reponame);
178extern char *cgit_pageurl(const char *reponame, const char *pagename, 180extern char *cgit_pageurl(const char *reponame, const char *pagename,
179 const char *query); 181 const char *query);
180 182
181extern void cgit_print_error(char *msg); 183extern void cgit_print_error(char *msg);
182extern void cgit_print_date(unsigned long secs); 184extern void cgit_print_date(unsigned long secs);
183extern void cgit_print_docstart(char *title, struct cacheitem *item); 185extern void cgit_print_docstart(char *title, struct cacheitem *item);
184extern void cgit_print_docend(); 186extern void cgit_print_docend();
185extern void cgit_print_pageheader(char *title, int show_search); 187extern void cgit_print_pageheader(char *title, int show_search);
186extern void cgit_print_snapshot_start(const char *mimetype, 188extern void cgit_print_snapshot_start(const char *mimetype,
187 const char *filename, 189 const char *filename,
188 struct cacheitem *item); 190 struct cacheitem *item);
189 191
190extern void cgit_print_repolist(struct cacheitem *item); 192extern void cgit_print_repolist(struct cacheitem *item);
191extern void cgit_print_summary(); 193extern void cgit_print_summary();
192extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path); 194extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path);
193extern void cgit_print_view(const char *hex, char *path); 195extern void cgit_print_view(const char *hex, char *path);
194extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); 196extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
195extern void cgit_print_tree(const char *rev, const char *hex, char *path); 197extern void cgit_print_tree(const char *rev, const char *hex, char *path);
196extern void cgit_print_commit(const char *hex); 198extern void cgit_print_commit(const char *hex);
197extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, 199extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex,
198 char *path); 200 char *path);
199extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, 201extern void cgit_print_snapshot(struct cacheitem *item, const char *hex,
200 const char *format, const char *prefix, 202 const char *format, const char *prefix,
201 const char *filename); 203 const char *filename);
202 204
203#endif /* CGIT_H */ 205#endif /* CGIT_H */