author | Lars Hjemli <hjemli@gmail.com> | 2006-12-15 17:17:36 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2006-12-15 17:17:36 (UTC) |
commit | 2101e26fd68f816e77de62b93df4c32fd1110d0c (patch) (unidiff) | |
tree | d70d28734c4fbfd0a4e4a40bcfd445eb50dc1666 /cgit.h | |
parent | 420712ac2531f65a2b94d5ec6d8e03de6942331e (diff) | |
download | cgit-2101e26fd68f816e77de62b93df4c32fd1110d0c.zip cgit-2101e26fd68f816e77de62b93df4c32fd1110d0c.tar.gz cgit-2101e26fd68f816e77de62b93df4c32fd1110d0c.tar.bz2 |
Add a common commit parser
Make a better commit parser, replacing the ugly one in ui-log.c
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1,89 +1,98 @@ | |||
1 | #ifndef CGIT_H | 1 | #ifndef CGIT_H |
2 | #define CGIT_H | 2 | #define CGIT_H |
3 | 3 | ||
4 | #include "git.h" | 4 | #include "git.h" |
5 | #include <openssl/sha.h> | 5 | #include <openssl/sha.h> |
6 | #include <ctype.h> | 6 | #include <ctype.h> |
7 | #include <sched.h> | 7 | #include <sched.h> |
8 | 8 | ||
9 | typedef void (*configfn)(const char *name, const char *value); | 9 | typedef void (*configfn)(const char *name, const char *value); |
10 | 10 | ||
11 | struct cacheitem { | 11 | struct cacheitem { |
12 | char *name; | 12 | char *name; |
13 | struct stat st; | 13 | struct stat st; |
14 | int ttl; | 14 | int ttl; |
15 | int fd; | 15 | int fd; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | struct commitinfo { | ||
19 | struct commit *commit; | ||
20 | char *author; | ||
21 | char *committer; | ||
22 | char *subject; | ||
23 | char *msg; | ||
24 | }; | ||
25 | |||
18 | extern const char cgit_version[]; | 26 | extern const char cgit_version[]; |
19 | 27 | ||
20 | extern char *cgit_root; | 28 | extern char *cgit_root; |
21 | extern char *cgit_root_title; | 29 | extern char *cgit_root_title; |
22 | extern char *cgit_css; | 30 | extern char *cgit_css; |
23 | extern char *cgit_logo; | 31 | extern char *cgit_logo; |
24 | extern char *cgit_logo_link; | 32 | extern char *cgit_logo_link; |
25 | extern char *cgit_virtual_root; | 33 | extern char *cgit_virtual_root; |
26 | extern char *cgit_cache_root; | 34 | extern char *cgit_cache_root; |
27 | 35 | ||
28 | extern int cgit_max_lock_attempts; | 36 | extern int cgit_max_lock_attempts; |
29 | extern int cgit_cache_root_ttl; | 37 | extern int cgit_cache_root_ttl; |
30 | extern int cgit_cache_repo_ttl; | 38 | extern int cgit_cache_repo_ttl; |
31 | extern int cgit_cache_dynamic_ttl; | 39 | extern int cgit_cache_dynamic_ttl; |
32 | extern int cgit_cache_static_ttl; | 40 | extern int cgit_cache_static_ttl; |
33 | extern int cgit_cache_max_create_time; | 41 | extern int cgit_cache_max_create_time; |
34 | 42 | ||
35 | extern char *cgit_repo_name; | 43 | extern char *cgit_repo_name; |
36 | extern char *cgit_repo_desc; | 44 | extern char *cgit_repo_desc; |
37 | extern char *cgit_repo_owner; | 45 | extern char *cgit_repo_owner; |
38 | 46 | ||
39 | extern int cgit_query_has_symref; | 47 | extern int cgit_query_has_symref; |
40 | extern int cgit_query_has_sha1; | 48 | extern int cgit_query_has_sha1; |
41 | 49 | ||
42 | extern char *cgit_querystring; | 50 | extern char *cgit_querystring; |
43 | extern char *cgit_query_repo; | 51 | extern char *cgit_query_repo; |
44 | extern char *cgit_query_page; | 52 | extern char *cgit_query_page; |
45 | extern char *cgit_query_head; | 53 | extern char *cgit_query_head; |
46 | extern char *cgit_query_sha1; | 54 | extern char *cgit_query_sha1; |
47 | extern int cgit_query_ofs; | 55 | extern int cgit_query_ofs; |
48 | 56 | ||
49 | extern int htmlfd; | 57 | extern int htmlfd; |
50 | 58 | ||
51 | extern void cgit_global_config_cb(const char *name, const char *value); | 59 | extern void cgit_global_config_cb(const char *name, const char *value); |
52 | extern void cgit_repo_config_cb(const char *name, const char *value); | 60 | extern void cgit_repo_config_cb(const char *name, const char *value); |
53 | extern void cgit_querystring_cb(const char *name, const char *value); | 61 | extern void cgit_querystring_cb(const char *name, const char *value); |
54 | 62 | ||
55 | extern char *fmt(const char *format,...); | 63 | extern char *fmt(const char *format,...); |
56 | 64 | ||
57 | extern void html(const char *txt); | 65 | extern void html(const char *txt); |
58 | extern void htmlf(const char *format,...); | 66 | extern void htmlf(const char *format,...); |
59 | extern void html_txt(char *txt); | 67 | extern void html_txt(char *txt); |
60 | extern void html_attr(char *txt); | 68 | extern void html_attr(char *txt); |
61 | extern void html_link_open(char *url, char *title, char *class); | 69 | extern void html_link_open(char *url, char *title, char *class); |
62 | extern void html_link_close(void); | 70 | extern void html_link_close(void); |
63 | 71 | ||
64 | extern int cgit_read_config(const char *filename, configfn fn); | 72 | extern int cgit_read_config(const char *filename, configfn fn); |
65 | extern int cgit_parse_query(char *txt, configfn fn); | 73 | extern int cgit_parse_query(char *txt, configfn fn); |
74 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); | ||
66 | 75 | ||
67 | extern void cache_prepare(struct cacheitem *item); | 76 | extern void cache_prepare(struct cacheitem *item); |
68 | extern int cache_lock(struct cacheitem *item); | 77 | extern int cache_lock(struct cacheitem *item); |
69 | extern int cache_unlock(struct cacheitem *item); | 78 | extern int cache_unlock(struct cacheitem *item); |
70 | extern int cache_cancel_lock(struct cacheitem *item); | 79 | extern int cache_cancel_lock(struct cacheitem *item); |
71 | extern int cache_exist(struct cacheitem *item); | 80 | extern int cache_exist(struct cacheitem *item); |
72 | extern int cache_expired(struct cacheitem *item); | 81 | extern int cache_expired(struct cacheitem *item); |
73 | 82 | ||
74 | extern char *cgit_repourl(const char *reponame); | 83 | extern char *cgit_repourl(const char *reponame); |
75 | extern char *cgit_pageurl(const char *reponame, const char *pagename, | 84 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
76 | const char *query); | 85 | const char *query); |
77 | 86 | ||
78 | extern void cgit_print_error(char *msg); | 87 | extern void cgit_print_error(char *msg); |
79 | extern void cgit_print_docstart(char *title, struct cacheitem *item); | 88 | extern void cgit_print_docstart(char *title, struct cacheitem *item); |
80 | extern void cgit_print_docend(); | 89 | extern void cgit_print_docend(); |
81 | extern void cgit_print_pageheader(char *title); | 90 | extern void cgit_print_pageheader(char *title); |
82 | 91 | ||
83 | extern void cgit_print_repolist(struct cacheitem *item); | 92 | extern void cgit_print_repolist(struct cacheitem *item); |
84 | extern void cgit_print_summary(); | 93 | extern void cgit_print_summary(); |
85 | extern void cgit_print_log(const char *tip, int ofs, int cnt); | 94 | extern void cgit_print_log(const char *tip, int ofs, int cnt); |
86 | extern void cgit_print_view(char *hex); | 95 | extern void cgit_print_view(char *hex); |
87 | extern void cgit_print_tree(const char *sha1); | 96 | extern void cgit_print_tree(const char *sha1); |
88 | 97 | ||
89 | #endif /* CGIT_H */ | 98 | #endif /* CGIT_H */ |