author | Lars Hjemli <hjemli@gmail.com> | 2007-05-11 10:12:48 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-11 10:12:48 (UTC) |
commit | ded9393b173853d2e960f9b176aeb0bc4ed35be2 (patch) (unidiff) | |
tree | 5c062b21e85ef0fe243ad900e9f4ffaf2ded0f62 /cgit.h | |
parent | cc1dbd1b5d610bd5e626f54d310f11cf47684ea1 (diff) | |
download | cgit-ded9393b173853d2e960f9b176aeb0bc4ed35be2.zip cgit-ded9393b173853d2e960f9b176aeb0bc4ed35be2.tar.gz cgit-ded9393b173853d2e960f9b176aeb0bc4ed35be2.tar.bz2 |
Add submodule links in tree listing
When a submodule occurs in a tree, generate a link to show the
module/commit. The link is specified as a sprintf string in /etc/cgitrc,
using parameters 'module-link' and 'repo.module-link'. This should probably
be extended with repo.module-link.$path.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1,167 +1,169 @@ | |||
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 | typedef void (*configfn)(const char *name, const char *value); | 21 | typedef void (*configfn)(const char *name, const char *value); |
22 | 22 | ||
23 | struct cacheitem { | 23 | struct cacheitem { |
24 | char *name; | 24 | char *name; |
25 | struct stat st; | 25 | struct stat st; |
26 | int ttl; | 26 | int ttl; |
27 | int fd; | 27 | int fd; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | struct repoinfo { | 30 | struct repoinfo { |
31 | char *url; | 31 | char *url; |
32 | char *name; | 32 | char *name; |
33 | char *path; | 33 | char *path; |
34 | char *desc; | 34 | char *desc; |
35 | char *owner; | 35 | char *owner; |
36 | char *module_link; | ||
36 | int snapshots; | 37 | int snapshots; |
37 | }; | 38 | }; |
38 | 39 | ||
39 | struct repolist { | 40 | struct repolist { |
40 | int length; | 41 | int length; |
41 | int count; | 42 | int count; |
42 | struct repoinfo *repos; | 43 | struct repoinfo *repos; |
43 | }; | 44 | }; |
44 | 45 | ||
45 | struct commitinfo { | 46 | struct commitinfo { |
46 | struct commit *commit; | 47 | struct commit *commit; |
47 | char *author; | 48 | char *author; |
48 | char *author_email; | 49 | char *author_email; |
49 | unsigned long author_date; | 50 | unsigned long author_date; |
50 | char *committer; | 51 | char *committer; |
51 | char *committer_email; | 52 | char *committer_email; |
52 | unsigned long committer_date; | 53 | unsigned long committer_date; |
53 | char *subject; | 54 | char *subject; |
54 | char *msg; | 55 | char *msg; |
55 | }; | 56 | }; |
56 | 57 | ||
57 | struct taginfo { | 58 | struct taginfo { |
58 | char *tagger; | 59 | char *tagger; |
59 | char *tagger_email; | 60 | char *tagger_email; |
60 | int tagger_date; | 61 | int tagger_date; |
61 | char *msg; | 62 | char *msg; |
62 | }; | 63 | }; |
63 | 64 | ||
64 | extern const char cgit_version[]; | 65 | extern const char cgit_version[]; |
65 | 66 | ||
66 | extern struct repolist cgit_repolist; | 67 | extern struct repolist cgit_repolist; |
67 | extern struct repoinfo *cgit_repo; | 68 | extern struct repoinfo *cgit_repo; |
68 | 69 | ||
69 | extern char *cgit_root_title; | 70 | extern char *cgit_root_title; |
70 | extern char *cgit_css; | 71 | extern char *cgit_css; |
71 | extern char *cgit_logo; | 72 | extern char *cgit_logo; |
72 | extern char *cgit_logo_link; | 73 | extern char *cgit_logo_link; |
74 | extern char *cgit_module_link; | ||
73 | extern char *cgit_virtual_root; | 75 | extern char *cgit_virtual_root; |
74 | extern char *cgit_cache_root; | 76 | extern char *cgit_cache_root; |
75 | 77 | ||
76 | extern int cgit_nocache; | 78 | extern int cgit_nocache; |
77 | extern int cgit_snapshots; | 79 | extern int cgit_snapshots; |
78 | extern int cgit_max_lock_attempts; | 80 | extern int cgit_max_lock_attempts; |
79 | extern int cgit_cache_root_ttl; | 81 | extern int cgit_cache_root_ttl; |
80 | extern int cgit_cache_repo_ttl; | 82 | extern int cgit_cache_repo_ttl; |
81 | extern int cgit_cache_dynamic_ttl; | 83 | extern int cgit_cache_dynamic_ttl; |
82 | extern int cgit_cache_static_ttl; | 84 | extern int cgit_cache_static_ttl; |
83 | extern int cgit_cache_max_create_time; | 85 | extern int cgit_cache_max_create_time; |
84 | 86 | ||
85 | extern int cgit_max_msg_len; | 87 | extern int cgit_max_msg_len; |
86 | 88 | ||
87 | extern char *cgit_repo_name; | 89 | extern char *cgit_repo_name; |
88 | extern char *cgit_repo_desc; | 90 | extern char *cgit_repo_desc; |
89 | extern char *cgit_repo_owner; | 91 | extern char *cgit_repo_owner; |
90 | 92 | ||
91 | extern int cgit_query_has_symref; | 93 | extern int cgit_query_has_symref; |
92 | extern int cgit_query_has_sha1; | 94 | extern int cgit_query_has_sha1; |
93 | 95 | ||
94 | extern char *cgit_querystring; | 96 | extern char *cgit_querystring; |
95 | extern char *cgit_query_repo; | 97 | extern char *cgit_query_repo; |
96 | extern char *cgit_query_page; | 98 | extern char *cgit_query_page; |
97 | extern char *cgit_query_search; | 99 | extern char *cgit_query_search; |
98 | extern char *cgit_query_head; | 100 | extern char *cgit_query_head; |
99 | extern char *cgit_query_sha1; | 101 | extern char *cgit_query_sha1; |
100 | extern char *cgit_query_sha2; | 102 | extern char *cgit_query_sha2; |
101 | extern char *cgit_query_path; | 103 | extern char *cgit_query_path; |
102 | extern char *cgit_query_name; | 104 | extern char *cgit_query_name; |
103 | extern int cgit_query_ofs; | 105 | extern int cgit_query_ofs; |
104 | 106 | ||
105 | extern int htmlfd; | 107 | extern int htmlfd; |
106 | 108 | ||
107 | extern void cgit_global_config_cb(const char *name, const char *value); | 109 | extern void cgit_global_config_cb(const char *name, const char *value); |
108 | extern void cgit_repo_config_cb(const char *name, const char *value); | 110 | extern void cgit_repo_config_cb(const char *name, const char *value); |
109 | extern void cgit_querystring_cb(const char *name, const char *value); | 111 | extern void cgit_querystring_cb(const char *name, const char *value); |
110 | 112 | ||
111 | extern int chk_zero(int result, char *msg); | 113 | extern int chk_zero(int result, char *msg); |
112 | extern int chk_positive(int result, char *msg); | 114 | extern int chk_positive(int result, char *msg); |
113 | 115 | ||
114 | extern int hextoint(char c); | 116 | extern int hextoint(char c); |
115 | 117 | ||
116 | extern void *cgit_free_commitinfo(struct commitinfo *info); | 118 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
117 | 119 | ||
118 | extern char *fmt(const char *format,...); | 120 | extern char *fmt(const char *format,...); |
119 | 121 | ||
120 | extern void html(const char *txt); | 122 | extern void html(const char *txt); |
121 | extern void htmlf(const char *format,...); | 123 | extern void htmlf(const char *format,...); |
122 | extern void html_txt(char *txt); | 124 | extern void html_txt(char *txt); |
123 | extern void html_ntxt(int len, char *txt); | 125 | extern void html_ntxt(int len, char *txt); |
124 | extern void html_attr(char *txt); | 126 | extern void html_attr(char *txt); |
125 | extern void html_hidden(char *name, char *value); | 127 | extern void html_hidden(char *name, char *value); |
126 | extern void html_link_open(char *url, char *title, char *class); | 128 | extern void html_link_open(char *url, char *title, char *class); |
127 | extern void html_link_close(void); | 129 | extern void html_link_close(void); |
128 | extern void html_filemode(unsigned short mode); | 130 | extern void html_filemode(unsigned short mode); |
129 | 131 | ||
130 | extern int cgit_read_config(const char *filename, configfn fn); | 132 | extern int cgit_read_config(const char *filename, configfn fn); |
131 | extern int cgit_parse_query(char *txt, configfn fn); | 133 | extern int cgit_parse_query(char *txt, configfn fn); |
132 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); | 134 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
133 | extern struct taginfo *cgit_parse_tag(struct tag *tag); | 135 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
134 | 136 | ||
135 | extern char *cache_safe_filename(const char *unsafe); | 137 | extern char *cache_safe_filename(const char *unsafe); |
136 | extern int cache_lock(struct cacheitem *item); | 138 | extern int cache_lock(struct cacheitem *item); |
137 | extern int cache_unlock(struct cacheitem *item); | 139 | extern int cache_unlock(struct cacheitem *item); |
138 | extern int cache_cancel_lock(struct cacheitem *item); | 140 | extern int cache_cancel_lock(struct cacheitem *item); |
139 | extern int cache_exist(struct cacheitem *item); | 141 | extern int cache_exist(struct cacheitem *item); |
140 | extern int cache_expired(struct cacheitem *item); | 142 | extern int cache_expired(struct cacheitem *item); |
141 | 143 | ||
142 | extern char *cgit_repourl(const char *reponame); | 144 | extern char *cgit_repourl(const char *reponame); |
143 | extern char *cgit_pageurl(const char *reponame, const char *pagename, | 145 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
144 | const char *query); | 146 | const char *query); |
145 | 147 | ||
146 | extern void cgit_print_error(char *msg); | 148 | extern void cgit_print_error(char *msg); |
147 | extern void cgit_print_date(unsigned long secs); | 149 | extern void cgit_print_date(unsigned long secs); |
148 | extern void cgit_print_docstart(char *title, struct cacheitem *item); | 150 | extern void cgit_print_docstart(char *title, struct cacheitem *item); |
149 | extern void cgit_print_docend(); | 151 | extern void cgit_print_docend(); |
150 | extern void cgit_print_pageheader(char *title, int show_search); | 152 | extern void cgit_print_pageheader(char *title, int show_search); |
151 | extern void cgit_print_snapshot_start(const char *mimetype, | 153 | extern void cgit_print_snapshot_start(const char *mimetype, |
152 | const char *filename, | 154 | const char *filename, |
153 | struct cacheitem *item); | 155 | struct cacheitem *item); |
154 | 156 | ||
155 | extern void cgit_print_repolist(struct cacheitem *item); | 157 | extern void cgit_print_repolist(struct cacheitem *item); |
156 | extern void cgit_print_summary(); | 158 | extern void cgit_print_summary(); |
157 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep); | 159 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep); |
158 | extern void cgit_print_view(const char *hex, char *path); | 160 | extern void cgit_print_view(const char *hex, char *path); |
159 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); | 161 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
160 | extern void cgit_print_tree(const char *hex, char *path); | 162 | extern void cgit_print_tree(const char *hex, char *path); |
161 | extern void cgit_print_commit(const char *hex); | 163 | extern void cgit_print_commit(const char *hex); |
162 | extern void cgit_print_diff(const char *old_hex, const char *new_hex); | 164 | extern void cgit_print_diff(const char *old_hex, const char *new_hex); |
163 | extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, | 165 | extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, |
164 | const char *format, const char *prefix, | 166 | const char *format, const char *prefix, |
165 | const char *filename); | 167 | const char *filename); |
166 | 168 | ||
167 | #endif /* CGIT_H */ | 169 | #endif /* CGIT_H */ |