|
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 | |
32 | typedef void (*configfn)(const char *name, const char *value); |
32 | typedef void (*configfn)(const char *name, const char *value); |
33 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
33 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
34 | typedef void (*linediff_fn)(char *line, int len); |
34 | typedef void (*linediff_fn)(char *line, int len); |
35 | |
35 | |
36 | struct cacheitem { |
36 | struct 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 | |
43 | struct repoinfo { |
43 | struct 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 | |
56 | struct repolist { |
57 | struct 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 | |
62 | struct commitinfo { |
63 | struct 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 | |
74 | struct taginfo { |
75 | struct 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 | |
81 | extern const char cgit_version[]; |
82 | extern const char cgit_version[]; |
82 | |
83 | |
83 | extern struct repolist cgit_repolist; |
84 | extern struct repolist cgit_repolist; |
84 | extern struct repoinfo *cgit_repo; |
85 | extern struct repoinfo *cgit_repo; |
85 | extern int cgit_cmd; |
86 | extern int cgit_cmd; |
86 | |
87 | |
87 | extern char *cgit_root_title; |
88 | extern char *cgit_root_title; |
88 | extern char *cgit_css; |
89 | extern char *cgit_css; |
89 | extern char *cgit_logo; |
90 | extern char *cgit_logo; |
90 | extern char *cgit_index_header; |
91 | extern char *cgit_index_header; |
91 | extern char *cgit_logo_link; |
92 | extern char *cgit_logo_link; |
92 | extern char *cgit_module_link; |
93 | extern char *cgit_module_link; |
93 | extern char *cgit_virtual_root; |
94 | extern char *cgit_virtual_root; |
94 | extern char *cgit_script_name; |
95 | extern char *cgit_script_name; |
95 | extern char *cgit_cache_root; |
96 | extern char *cgit_cache_root; |
| |
97 | extern char *cgit_repo_group; |
96 | |
98 | |
97 | extern int cgit_nocache; |
99 | extern int cgit_nocache; |
98 | extern int cgit_snapshots; |
100 | extern int cgit_snapshots; |
99 | extern int cgit_enable_log_filecount; |
101 | extern int cgit_enable_log_filecount; |
100 | extern int cgit_enable_log_linecount; |
102 | extern int cgit_enable_log_linecount; |
101 | extern int cgit_max_lock_attempts; |
103 | extern int cgit_max_lock_attempts; |
102 | extern int cgit_cache_root_ttl; |
104 | extern int cgit_cache_root_ttl; |
103 | extern int cgit_cache_repo_ttl; |
105 | extern int cgit_cache_repo_ttl; |
104 | extern int cgit_cache_dynamic_ttl; |
106 | extern int cgit_cache_dynamic_ttl; |
105 | extern int cgit_cache_static_ttl; |
107 | extern int cgit_cache_static_ttl; |
106 | extern int cgit_cache_max_create_time; |
108 | extern int cgit_cache_max_create_time; |
107 | |
109 | |
108 | extern int cgit_max_msg_len; |
110 | extern int cgit_max_msg_len; |
109 | extern int cgit_max_repodesc_len; |
111 | extern int cgit_max_repodesc_len; |
110 | extern int cgit_max_commit_count; |
112 | extern int cgit_max_commit_count; |
111 | |
113 | |
112 | extern int cgit_query_has_symref; |
114 | extern int cgit_query_has_symref; |
113 | extern int cgit_query_has_sha1; |
115 | extern int cgit_query_has_sha1; |
114 | |
116 | |
115 | extern char *cgit_querystring; |
117 | extern char *cgit_querystring; |
116 | extern char *cgit_query_repo; |
118 | extern char *cgit_query_repo; |
117 | extern char *cgit_query_page; |
119 | extern char *cgit_query_page; |
118 | extern char *cgit_query_search; |
120 | extern char *cgit_query_search; |
119 | extern char *cgit_query_head; |
121 | extern char *cgit_query_head; |
120 | extern char *cgit_query_sha1; |
122 | extern char *cgit_query_sha1; |
121 | extern char *cgit_query_sha2; |
123 | extern char *cgit_query_sha2; |
122 | extern char *cgit_query_path; |
124 | extern char *cgit_query_path; |
123 | extern char *cgit_query_name; |
125 | extern char *cgit_query_name; |
124 | extern int cgit_query_ofs; |
126 | extern int cgit_query_ofs; |
125 | |
127 | |
126 | extern int htmlfd; |
128 | extern int htmlfd; |
127 | |
129 | |
128 | extern int cgit_get_cmd_index(const char *cmd); |
130 | extern int cgit_get_cmd_index(const char *cmd); |
129 | extern struct repoinfo *cgit_get_repoinfo(const char *url); |
131 | extern struct repoinfo *cgit_get_repoinfo(const char *url); |
130 | extern void cgit_global_config_cb(const char *name, const char *value); |
132 | extern void cgit_global_config_cb(const char *name, const char *value); |
131 | extern void cgit_repo_config_cb(const char *name, const char *value); |
133 | extern void cgit_repo_config_cb(const char *name, const char *value); |
132 | extern void cgit_querystring_cb(const char *name, const char *value); |
134 | extern void cgit_querystring_cb(const char *name, const char *value); |
133 | |
135 | |
134 | extern int chk_zero(int result, char *msg); |
136 | extern int chk_zero(int result, char *msg); |
135 | extern int chk_positive(int result, char *msg); |
137 | extern int chk_positive(int result, char *msg); |
136 | |
138 | |
137 | extern int hextoint(char c); |
139 | extern int hextoint(char c); |
138 | |
140 | |
139 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
141 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
140 | |
142 | |
141 | extern int cgit_diff_files(const unsigned char *old_sha1, |
143 | extern 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 | |
145 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
147 | extern 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 | |
149 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
151 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
150 | |
152 | |
151 | extern char *fmt(const char *format,...); |
153 | extern char *fmt(const char *format,...); |
152 | |
154 | |
153 | extern void html(const char *txt); |
155 | extern void html(const char *txt); |
154 | extern void htmlf(const char *format,...); |
156 | extern void htmlf(const char *format,...); |
155 | extern void html_txt(char *txt); |
157 | extern void html_txt(char *txt); |
156 | extern void html_ntxt(int len, char *txt); |
158 | extern void html_ntxt(int len, char *txt); |
157 | extern void html_attr(char *txt); |
159 | extern void html_attr(char *txt); |
158 | extern void html_hidden(char *name, char *value); |
160 | extern void html_hidden(char *name, char *value); |
159 | extern void html_link_open(char *url, char *title, char *class); |
161 | extern void html_link_open(char *url, char *title, char *class); |
160 | extern void html_link_close(void); |
162 | extern void html_link_close(void); |
161 | extern void html_filemode(unsigned short mode); |
163 | extern void html_filemode(unsigned short mode); |
162 | extern int html_include(const char *filename); |
164 | extern int html_include(const char *filename); |
163 | |
165 | |
164 | extern int cgit_read_config(const char *filename, configfn fn); |
166 | extern int cgit_read_config(const char *filename, configfn fn); |
165 | extern int cgit_parse_query(char *txt, configfn fn); |
167 | extern int cgit_parse_query(char *txt, configfn fn); |
166 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
168 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
167 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
169 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
168 | extern void cgit_parse_url(const char *url); |
170 | extern void cgit_parse_url(const char *url); |
169 | |
171 | |
170 | extern char *cache_safe_filename(const char *unsafe); |
172 | extern char *cache_safe_filename(const char *unsafe); |
171 | extern int cache_lock(struct cacheitem *item); |
173 | extern int cache_lock(struct cacheitem *item); |
172 | extern int cache_unlock(struct cacheitem *item); |
174 | extern int cache_unlock(struct cacheitem *item); |
173 | extern int cache_cancel_lock(struct cacheitem *item); |
175 | extern int cache_cancel_lock(struct cacheitem *item); |
174 | extern int cache_exist(struct cacheitem *item); |
176 | extern int cache_exist(struct cacheitem *item); |
175 | extern int cache_expired(struct cacheitem *item); |
177 | extern int cache_expired(struct cacheitem *item); |
176 | |
178 | |
177 | extern char *cgit_repourl(const char *reponame); |
179 | extern char *cgit_repourl(const char *reponame); |
178 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
180 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
179 | const char *query); |
181 | const char *query); |
180 | |
182 | |
181 | extern void cgit_print_error(char *msg); |
183 | extern void cgit_print_error(char *msg); |
182 | extern void cgit_print_date(unsigned long secs); |
184 | extern void cgit_print_date(unsigned long secs); |
183 | extern void cgit_print_docstart(char *title, struct cacheitem *item); |
185 | extern void cgit_print_docstart(char *title, struct cacheitem *item); |
184 | extern void cgit_print_docend(); |
186 | extern void cgit_print_docend(); |
185 | extern void cgit_print_pageheader(char *title, int show_search); |
187 | extern void cgit_print_pageheader(char *title, int show_search); |
186 | extern void cgit_print_snapshot_start(const char *mimetype, |
188 | extern 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 | |
190 | extern void cgit_print_repolist(struct cacheitem *item); |
192 | extern void cgit_print_repolist(struct cacheitem *item); |
191 | extern void cgit_print_summary(); |
193 | extern void cgit_print_summary(); |
192 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path); |
194 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path); |
193 | extern void cgit_print_view(const char *hex, char *path); |
195 | extern void cgit_print_view(const char *hex, char *path); |
194 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
196 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
195 | extern void cgit_print_tree(const char *rev, const char *hex, char *path); |
197 | extern void cgit_print_tree(const char *rev, const char *hex, char *path); |
196 | extern void cgit_print_commit(const char *hex); |
198 | extern void cgit_print_commit(const char *hex); |
197 | extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, |
199 | extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, |
198 | char *path); |
200 | char *path); |
199 | extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, |
201 | extern 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 */ |
|