author | Lars Hjemli <hjemli@gmail.com> | 2011-02-19 13:51:00 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2011-02-19 13:51:00 (UTC) |
commit | 979c460e7f71d153ae79da67b8b21c3412f0fe02 (patch) (unidiff) | |
tree | 6da9ffb66ed0a68205e6644cb7e2b4652d6684be /cgit.h | |
parent | fb9e6d1594a24fe4e551fd57a9c91fd18b14806e (diff) | |
parent | 0141b9f889bbaa1fe474f9a98dd377138ac73054 (diff) | |
download | cgit-979c460e7f71d153ae79da67b8b21c3412f0fe02.zip cgit-979c460e7f71d153ae79da67b8b21c3412f0fe02.tar.gz cgit-979c460e7f71d153ae79da67b8b21c3412f0fe02.tar.bz2 |
Merge branch 'br/misc'
* br/misc:
Use transparent background for the cgit logo
ssdiff: anchors for ssdiff
implement repo.logo and repo.logo-link
-rw-r--r-- | cgit.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1,322 +1,324 @@ | |||
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 <string-list.h> | 18 | #include <string-list.h> |
19 | #include <xdiff-interface.h> | 19 | #include <xdiff-interface.h> |
20 | #include <xdiff/xdiff.h> | 20 | #include <xdiff/xdiff.h> |
21 | #include <utf8.h> | 21 | #include <utf8.h> |
22 | #include <notes.h> | 22 | #include <notes.h> |
23 | #include <graph.h> | 23 | #include <graph.h> |
24 | 24 | ||
25 | 25 | ||
26 | /* | 26 | /* |
27 | * Dateformats used on misc. pages | 27 | * Dateformats used on misc. pages |
28 | */ | 28 | */ |
29 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" | 29 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" |
30 | #define FMT_SHORTDATE "%Y-%m-%d" | 30 | #define FMT_SHORTDATE "%Y-%m-%d" |
31 | #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" | 31 | #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" |
32 | 32 | ||
33 | 33 | ||
34 | /* | 34 | /* |
35 | * Limits used for relative dates | 35 | * Limits used for relative dates |
36 | */ | 36 | */ |
37 | #define TM_MIN 60 | 37 | #define TM_MIN 60 |
38 | #define TM_HOUR (TM_MIN * 60) | 38 | #define TM_HOUR (TM_MIN * 60) |
39 | #define TM_DAY (TM_HOUR * 24) | 39 | #define TM_DAY (TM_HOUR * 24) |
40 | #define TM_WEEK (TM_DAY * 7) | 40 | #define TM_WEEK (TM_DAY * 7) |
41 | #define TM_YEAR (TM_DAY * 365) | 41 | #define TM_YEAR (TM_DAY * 365) |
42 | #define TM_MONTH (TM_YEAR / 12.0) | 42 | #define TM_MONTH (TM_YEAR / 12.0) |
43 | 43 | ||
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Default encoding | 46 | * Default encoding |
47 | */ | 47 | */ |
48 | #define PAGE_ENCODING "UTF-8" | 48 | #define PAGE_ENCODING "UTF-8" |
49 | 49 | ||
50 | typedef void (*configfn)(const char *name, const char *value); | 50 | typedef void (*configfn)(const char *name, const char *value); |
51 | typedef void (*filepair_fn)(struct diff_filepair *pair); | 51 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
52 | typedef void (*linediff_fn)(char *line, int len); | 52 | typedef void (*linediff_fn)(char *line, int len); |
53 | 53 | ||
54 | struct cgit_filter { | 54 | struct cgit_filter { |
55 | char *cmd; | 55 | char *cmd; |
56 | char **argv; | 56 | char **argv; |
57 | int old_stdout; | 57 | int old_stdout; |
58 | int pipe_fh[2]; | 58 | int pipe_fh[2]; |
59 | int pid; | 59 | int pid; |
60 | int exitstatus; | 60 | int exitstatus; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | struct cgit_repo { | 63 | struct cgit_repo { |
64 | char *url; | 64 | char *url; |
65 | char *name; | 65 | char *name; |
66 | char *path; | 66 | char *path; |
67 | char *desc; | 67 | char *desc; |
68 | char *owner; | 68 | char *owner; |
69 | char *defbranch; | 69 | char *defbranch; |
70 | char *module_link; | 70 | char *module_link; |
71 | char *readme; | 71 | char *readme; |
72 | char *section; | 72 | char *section; |
73 | char *clone_url; | 73 | char *clone_url; |
74 | char *logo; | ||
75 | char *logo_link; | ||
74 | int snapshots; | 76 | int snapshots; |
75 | int enable_commit_graph; | 77 | int enable_commit_graph; |
76 | int enable_log_filecount; | 78 | int enable_log_filecount; |
77 | int enable_log_linecount; | 79 | int enable_log_linecount; |
78 | int enable_remote_branches; | 80 | int enable_remote_branches; |
79 | int enable_subject_links; | 81 | int enable_subject_links; |
80 | int max_stats; | 82 | int max_stats; |
81 | time_t mtime; | 83 | time_t mtime; |
82 | struct cgit_filter *about_filter; | 84 | struct cgit_filter *about_filter; |
83 | struct cgit_filter *commit_filter; | 85 | struct cgit_filter *commit_filter; |
84 | struct cgit_filter *source_filter; | 86 | struct cgit_filter *source_filter; |
85 | }; | 87 | }; |
86 | 88 | ||
87 | typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, | 89 | typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, |
88 | const char *value); | 90 | const char *value); |
89 | 91 | ||
90 | struct cgit_repolist { | 92 | struct cgit_repolist { |
91 | int length; | 93 | int length; |
92 | int count; | 94 | int count; |
93 | struct cgit_repo *repos; | 95 | struct cgit_repo *repos; |
94 | }; | 96 | }; |
95 | 97 | ||
96 | struct commitinfo { | 98 | struct commitinfo { |
97 | struct commit *commit; | 99 | struct commit *commit; |
98 | char *author; | 100 | char *author; |
99 | char *author_email; | 101 | char *author_email; |
100 | unsigned long author_date; | 102 | unsigned long author_date; |
101 | char *committer; | 103 | char *committer; |
102 | char *committer_email; | 104 | char *committer_email; |
103 | unsigned long committer_date; | 105 | unsigned long committer_date; |
104 | char *subject; | 106 | char *subject; |
105 | char *msg; | 107 | char *msg; |
106 | char *msg_encoding; | 108 | char *msg_encoding; |
107 | }; | 109 | }; |
108 | 110 | ||
109 | struct taginfo { | 111 | struct taginfo { |
110 | char *tagger; | 112 | char *tagger; |
111 | char *tagger_email; | 113 | char *tagger_email; |
112 | unsigned long tagger_date; | 114 | unsigned long tagger_date; |
113 | char *msg; | 115 | char *msg; |
114 | }; | 116 | }; |
115 | 117 | ||
116 | struct refinfo { | 118 | struct refinfo { |
117 | const char *refname; | 119 | const char *refname; |
118 | struct object *object; | 120 | struct object *object; |
119 | union { | 121 | union { |
120 | struct taginfo *tag; | 122 | struct taginfo *tag; |
121 | struct commitinfo *commit; | 123 | struct commitinfo *commit; |
122 | }; | 124 | }; |
123 | }; | 125 | }; |
124 | 126 | ||
125 | struct reflist { | 127 | struct reflist { |
126 | struct refinfo **refs; | 128 | struct refinfo **refs; |
127 | int alloc; | 129 | int alloc; |
128 | int count; | 130 | int count; |
129 | }; | 131 | }; |
130 | 132 | ||
131 | struct cgit_query { | 133 | struct cgit_query { |
132 | int has_symref; | 134 | int has_symref; |
133 | int has_sha1; | 135 | int has_sha1; |
134 | char *raw; | 136 | char *raw; |
135 | char *repo; | 137 | char *repo; |
136 | char *page; | 138 | char *page; |
137 | char *search; | 139 | char *search; |
138 | char *grep; | 140 | char *grep; |
139 | char *head; | 141 | char *head; |
140 | char *sha1; | 142 | char *sha1; |
141 | char *sha2; | 143 | char *sha2; |
142 | char *path; | 144 | char *path; |
143 | char *name; | 145 | char *name; |
144 | char *mimetype; | 146 | char *mimetype; |
145 | char *url; | 147 | char *url; |
146 | char *period; | 148 | char *period; |
147 | int ofs; | 149 | int ofs; |
148 | int nohead; | 150 | int nohead; |
149 | char *sort; | 151 | char *sort; |
150 | int showmsg; | 152 | int showmsg; |
151 | int ssdiff; | 153 | int ssdiff; |
152 | int show_all; | 154 | int show_all; |
153 | int context; | 155 | int context; |
154 | int ignorews; | 156 | int ignorews; |
155 | char *vpath; | 157 | char *vpath; |
156 | }; | 158 | }; |
157 | 159 | ||
158 | struct cgit_config { | 160 | struct cgit_config { |
159 | char *agefile; | 161 | char *agefile; |
160 | char *cache_root; | 162 | char *cache_root; |
161 | char *clone_prefix; | 163 | char *clone_prefix; |
162 | char *css; | 164 | char *css; |
163 | char *favicon; | 165 | char *favicon; |
164 | char *footer; | 166 | char *footer; |
165 | char *head_include; | 167 | char *head_include; |
166 | char *header; | 168 | char *header; |
167 | char *index_header; | 169 | char *index_header; |
168 | char *index_info; | 170 | char *index_info; |
169 | char *logo; | 171 | char *logo; |
170 | char *logo_link; | 172 | char *logo_link; |
171 | char *module_link; | 173 | char *module_link; |
172 | char *project_list; | 174 | char *project_list; |
173 | char *readme; | 175 | char *readme; |
174 | char *robots; | 176 | char *robots; |
175 | char *root_title; | 177 | char *root_title; |
176 | char *root_desc; | 178 | char *root_desc; |
177 | char *root_readme; | 179 | char *root_readme; |
178 | char *script_name; | 180 | char *script_name; |
179 | char *section; | 181 | char *section; |
180 | char *virtual_root; | 182 | char *virtual_root; |
181 | char *strict_export; | 183 | char *strict_export; |
182 | int cache_size; | 184 | int cache_size; |
183 | int cache_dynamic_ttl; | 185 | int cache_dynamic_ttl; |
184 | int cache_max_create_time; | 186 | int cache_max_create_time; |
185 | int cache_repo_ttl; | 187 | int cache_repo_ttl; |
186 | int cache_root_ttl; | 188 | int cache_root_ttl; |
187 | int cache_scanrc_ttl; | 189 | int cache_scanrc_ttl; |
188 | int cache_static_ttl; | 190 | int cache_static_ttl; |
189 | int embedded; | 191 | int embedded; |
190 | int enable_filter_overrides; | 192 | int enable_filter_overrides; |
191 | int enable_gitweb_owner; | 193 | int enable_gitweb_owner; |
192 | int enable_index_links; | 194 | int enable_index_links; |
193 | int enable_commit_graph; | 195 | int enable_commit_graph; |
194 | int enable_log_filecount; | 196 | int enable_log_filecount; |
195 | int enable_log_linecount; | 197 | int enable_log_linecount; |
196 | int enable_remote_branches; | 198 | int enable_remote_branches; |
197 | int enable_subject_links; | 199 | int enable_subject_links; |
198 | int enable_tree_linenumbers; | 200 | int enable_tree_linenumbers; |
199 | int local_time; | 201 | int local_time; |
200 | int max_atom_items; | 202 | int max_atom_items; |
201 | int max_repo_count; | 203 | int max_repo_count; |
202 | int max_commit_count; | 204 | int max_commit_count; |
203 | int max_lock_attempts; | 205 | int max_lock_attempts; |
204 | int max_msg_len; | 206 | int max_msg_len; |
205 | int max_repodesc_len; | 207 | int max_repodesc_len; |
206 | int max_blob_size; | 208 | int max_blob_size; |
207 | int max_stats; | 209 | int max_stats; |
208 | int nocache; | 210 | int nocache; |
209 | int noplainemail; | 211 | int noplainemail; |
210 | int noheader; | 212 | int noheader; |
211 | int renamelimit; | 213 | int renamelimit; |
212 | int remove_suffix; | 214 | int remove_suffix; |
213 | int scan_hidden_path; | 215 | int scan_hidden_path; |
214 | int section_from_path; | 216 | int section_from_path; |
215 | int snapshots; | 217 | int snapshots; |
216 | int summary_branches; | 218 | int summary_branches; |
217 | int summary_log; | 219 | int summary_log; |
218 | int summary_tags; | 220 | int summary_tags; |
219 | int ssdiff; | 221 | int ssdiff; |
220 | struct string_list mimetypes; | 222 | struct string_list mimetypes; |
221 | struct cgit_filter *about_filter; | 223 | struct cgit_filter *about_filter; |
222 | struct cgit_filter *commit_filter; | 224 | struct cgit_filter *commit_filter; |
223 | struct cgit_filter *source_filter; | 225 | struct cgit_filter *source_filter; |
224 | }; | 226 | }; |
225 | 227 | ||
226 | struct cgit_page { | 228 | struct cgit_page { |
227 | time_t modified; | 229 | time_t modified; |
228 | time_t expires; | 230 | time_t expires; |
229 | size_t size; | 231 | size_t size; |
230 | char *mimetype; | 232 | char *mimetype; |
231 | char *charset; | 233 | char *charset; |
232 | char *filename; | 234 | char *filename; |
233 | char *etag; | 235 | char *etag; |
234 | char *title; | 236 | char *title; |
235 | int status; | 237 | int status; |
236 | char *statusmsg; | 238 | char *statusmsg; |
237 | }; | 239 | }; |
238 | 240 | ||
239 | struct cgit_environment { | 241 | struct cgit_environment { |
240 | char *cgit_config; | 242 | char *cgit_config; |
241 | char *http_host; | 243 | char *http_host; |
242 | char *https; | 244 | char *https; |
243 | char *no_http; | 245 | char *no_http; |
244 | char *path_info; | 246 | char *path_info; |
245 | char *query_string; | 247 | char *query_string; |
246 | char *request_method; | 248 | char *request_method; |
247 | char *script_name; | 249 | char *script_name; |
248 | char *server_name; | 250 | char *server_name; |
249 | char *server_port; | 251 | char *server_port; |
250 | }; | 252 | }; |
251 | 253 | ||
252 | struct cgit_context { | 254 | struct cgit_context { |
253 | struct cgit_environment env; | 255 | struct cgit_environment env; |
254 | struct cgit_query qry; | 256 | struct cgit_query qry; |
255 | struct cgit_config cfg; | 257 | struct cgit_config cfg; |
256 | struct cgit_repo *repo; | 258 | struct cgit_repo *repo; |
257 | struct cgit_page page; | 259 | struct cgit_page page; |
258 | }; | 260 | }; |
259 | 261 | ||
260 | struct cgit_snapshot_format { | 262 | struct cgit_snapshot_format { |
261 | const char *suffix; | 263 | const char *suffix; |
262 | const char *mimetype; | 264 | const char *mimetype; |
263 | write_archive_fn_t write_func; | 265 | write_archive_fn_t write_func; |
264 | int bit; | 266 | int bit; |
265 | }; | 267 | }; |
266 | 268 | ||
267 | extern const char *cgit_version; | 269 | extern const char *cgit_version; |
268 | 270 | ||
269 | extern struct cgit_repolist cgit_repolist; | 271 | extern struct cgit_repolist cgit_repolist; |
270 | extern struct cgit_context ctx; | 272 | extern struct cgit_context ctx; |
271 | extern const struct cgit_snapshot_format cgit_snapshot_formats[]; | 273 | extern const struct cgit_snapshot_format cgit_snapshot_formats[]; |
272 | 274 | ||
273 | extern struct cgit_repo *cgit_add_repo(const char *url); | 275 | extern struct cgit_repo *cgit_add_repo(const char *url); |
274 | extern struct cgit_repo *cgit_get_repoinfo(const char *url); | 276 | extern struct cgit_repo *cgit_get_repoinfo(const char *url); |
275 | extern void cgit_repo_config_cb(const char *name, const char *value); | 277 | extern void cgit_repo_config_cb(const char *name, const char *value); |
276 | 278 | ||
277 | extern int chk_zero(int result, char *msg); | 279 | extern int chk_zero(int result, char *msg); |
278 | extern int chk_positive(int result, char *msg); | 280 | extern int chk_positive(int result, char *msg); |
279 | extern int chk_non_negative(int result, char *msg); | 281 | extern int chk_non_negative(int result, char *msg); |
280 | 282 | ||
281 | extern char *trim_end(const char *str, char c); | 283 | extern char *trim_end(const char *str, char c); |
282 | extern char *strlpart(char *txt, int maxlen); | 284 | extern char *strlpart(char *txt, int maxlen); |
283 | extern char *strrpart(char *txt, int maxlen); | 285 | extern char *strrpart(char *txt, int maxlen); |
284 | 286 | ||
285 | extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); | 287 | extern void cgit_add_ref(struct reflist *list, struct refinfo *ref); |
286 | extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, | 288 | extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, |
287 | int flags, void *cb_data); | 289 | int flags, void *cb_data); |
288 | 290 | ||
289 | extern void *cgit_free_commitinfo(struct commitinfo *info); | 291 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
290 | 292 | ||
291 | extern int cgit_diff_files(const unsigned char *old_sha1, | 293 | extern int cgit_diff_files(const unsigned char *old_sha1, |
292 | const unsigned char *new_sha1, | 294 | const unsigned char *new_sha1, |
293 | unsigned long *old_size, unsigned long *new_size, | 295 | unsigned long *old_size, unsigned long *new_size, |
294 | int *binary, int context, int ignorews, | 296 | int *binary, int context, int ignorews, |
295 | linediff_fn fn); | 297 | linediff_fn fn); |
296 | 298 | ||
297 | extern void cgit_diff_tree(const unsigned char *old_sha1, | 299 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
298 | const unsigned char *new_sha1, | 300 | const unsigned char *new_sha1, |
299 | filepair_fn fn, const char *prefix, int ignorews); | 301 | filepair_fn fn, const char *prefix, int ignorews); |
300 | 302 | ||
301 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn, | 303 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn, |
302 | const char *prefix); | 304 | const char *prefix); |
303 | 305 | ||
304 | __attribute__((format (printf,1,2))) | 306 | __attribute__((format (printf,1,2))) |
305 | extern char *fmt(const char *format,...); | 307 | extern char *fmt(const char *format,...); |
306 | 308 | ||
307 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); | 309 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
308 | extern struct taginfo *cgit_parse_tag(struct tag *tag); | 310 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
309 | extern void cgit_parse_url(const char *url); | 311 | extern void cgit_parse_url(const char *url); |
310 | 312 | ||
311 | extern const char *cgit_repobasename(const char *reponame); | 313 | extern const char *cgit_repobasename(const char *reponame); |
312 | 314 | ||
313 | extern int cgit_parse_snapshots_mask(const char *str); | 315 | extern int cgit_parse_snapshots_mask(const char *str); |
314 | 316 | ||
315 | extern int cgit_open_filter(struct cgit_filter *filter); | 317 | extern int cgit_open_filter(struct cgit_filter *filter); |
316 | extern int cgit_close_filter(struct cgit_filter *filter); | 318 | extern int cgit_close_filter(struct cgit_filter *filter); |
317 | 319 | ||
318 | extern int readfile(const char *path, char **buf, size_t *size); | 320 | extern int readfile(const char *path, char **buf, size_t *size); |
319 | 321 | ||
320 | extern char *expand_macros(const char *txt); | 322 | extern char *expand_macros(const char *txt); |
321 | 323 | ||
322 | #endif /* CGIT_H */ | 324 | #endif /* CGIT_H */ |