author | Lars Hjemli <hjemli@gmail.com> | 2007-06-16 18:20:42 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-06-16 18:20:42 (UTC) |
commit | ffc69736a606fd8f9a10468cce48b9a37b428944 (patch) (unidiff) | |
tree | b080c702391244a525fa0e7c97758f7f7fa0c383 /cgit.h | |
parent | 849f0f0f02f858e21fbe59295846e51628f82915 (diff) | |
download | cgit-ffc69736a606fd8f9a10468cce48b9a37b428944.zip cgit-ffc69736a606fd8f9a10468cce48b9a37b428944.tar.gz cgit-ffc69736a606fd8f9a10468cce48b9a37b428944.tar.bz2 |
ui-tree: unify with ui-view, use path to select tree/blob
This teaches ui-tree to show both trees and blobs, thereby making ui-view
superfluous. At the same time, ui-tree is extended to honour the specified
path instead of requiering a tree/blob sha1.
-rw-r--r-- | cgit.h | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,78 +1,77 @@ | |||
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_BLOB 5 |
29 | #define CMD_BLOB 6 | 29 | #define CMD_SNAPSHOT 6 |
30 | #define CMD_SNAPSHOT 7 | ||
31 | 30 | ||
32 | 31 | ||
33 | /* | 32 | /* |
34 | * Dateformats used on misc. pages | 33 | * Dateformats used on misc. pages |
35 | */ | 34 | */ |
36 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S" | 35 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S" |
37 | #define FMT_SHORTDATE "%Y-%m-%d" | 36 | #define FMT_SHORTDATE "%Y-%m-%d" |
38 | 37 | ||
39 | 38 | ||
40 | /* | 39 | /* |
41 | * Limits used for relative dates | 40 | * Limits used for relative dates |
42 | */ | 41 | */ |
43 | #define TM_MIN 60 | 42 | #define TM_MIN 60 |
44 | #define TM_HOUR (TM_MIN * 60) | 43 | #define TM_HOUR (TM_MIN * 60) |
45 | #define TM_DAY (TM_HOUR * 24) | 44 | #define TM_DAY (TM_HOUR * 24) |
46 | #define TM_WEEK (TM_DAY * 7) | 45 | #define TM_WEEK (TM_DAY * 7) |
47 | #define TM_YEAR (TM_DAY * 365) | 46 | #define TM_YEAR (TM_DAY * 365) |
48 | #define TM_MONTH (TM_YEAR / 12.0) | 47 | #define TM_MONTH (TM_YEAR / 12.0) |
49 | 48 | ||
50 | 49 | ||
51 | typedef void (*configfn)(const char *name, const char *value); | 50 | typedef void (*configfn)(const char *name, const char *value); |
52 | typedef void (*filepair_fn)(struct diff_filepair *pair); | 51 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
53 | typedef void (*linediff_fn)(char *line, int len); | 52 | typedef void (*linediff_fn)(char *line, int len); |
54 | 53 | ||
55 | struct cacheitem { | 54 | struct cacheitem { |
56 | char *name; | 55 | char *name; |
57 | struct stat st; | 56 | struct stat st; |
58 | int ttl; | 57 | int ttl; |
59 | int fd; | 58 | int fd; |
60 | }; | 59 | }; |
61 | 60 | ||
62 | struct repoinfo { | 61 | struct repoinfo { |
63 | char *url; | 62 | char *url; |
64 | char *name; | 63 | char *name; |
65 | char *path; | 64 | char *path; |
66 | char *desc; | 65 | char *desc; |
67 | char *owner; | 66 | char *owner; |
68 | char *defbranch; | 67 | char *defbranch; |
69 | char *group; | 68 | char *group; |
70 | char *module_link; | 69 | char *module_link; |
71 | char *readme; | 70 | char *readme; |
72 | int snapshots; | 71 | int snapshots; |
73 | int enable_log_filecount; | 72 | int enable_log_filecount; |
74 | int enable_log_linecount; | 73 | int enable_log_linecount; |
75 | }; | 74 | }; |
76 | 75 | ||
77 | struct repolist { | 76 | struct repolist { |
78 | int length; | 77 | int length; |
@@ -170,59 +169,58 @@ extern void cgit_diff_tree(const unsigned char *old_sha1, | |||
170 | const unsigned char *new_sha1, | 169 | const unsigned char *new_sha1, |
171 | filepair_fn fn); | 170 | filepair_fn fn); |
172 | 171 | ||
173 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); | 172 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
174 | 173 | ||
175 | extern char *fmt(const char *format,...); | 174 | extern char *fmt(const char *format,...); |
176 | 175 | ||
177 | extern void html(const char *txt); | 176 | extern void html(const char *txt); |
178 | extern void htmlf(const char *format,...); | 177 | extern void htmlf(const char *format,...); |
179 | extern void html_txt(char *txt); | 178 | extern void html_txt(char *txt); |
180 | extern void html_ntxt(int len, char *txt); | 179 | extern void html_ntxt(int len, char *txt); |
181 | extern void html_attr(char *txt); | 180 | extern void html_attr(char *txt); |
182 | extern void html_hidden(char *name, char *value); | 181 | extern void html_hidden(char *name, char *value); |
183 | extern void html_link_open(char *url, char *title, char *class); | 182 | extern void html_link_open(char *url, char *title, char *class); |
184 | extern void html_link_close(void); | 183 | extern void html_link_close(void); |
185 | extern void html_filemode(unsigned short mode); | 184 | extern void html_filemode(unsigned short mode); |
186 | extern int html_include(const char *filename); | 185 | extern int html_include(const char *filename); |
187 | 186 | ||
188 | extern int cgit_read_config(const char *filename, configfn fn); | 187 | extern int cgit_read_config(const char *filename, configfn fn); |
189 | extern int cgit_parse_query(char *txt, configfn fn); | 188 | extern int cgit_parse_query(char *txt, configfn fn); |
190 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); | 189 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
191 | extern struct taginfo *cgit_parse_tag(struct tag *tag); | 190 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
192 | extern void cgit_parse_url(const char *url); | 191 | extern void cgit_parse_url(const char *url); |
193 | 192 | ||
194 | extern char *cache_safe_filename(const char *unsafe); | 193 | extern char *cache_safe_filename(const char *unsafe); |
195 | extern int cache_lock(struct cacheitem *item); | 194 | extern int cache_lock(struct cacheitem *item); |
196 | extern int cache_unlock(struct cacheitem *item); | 195 | extern int cache_unlock(struct cacheitem *item); |
197 | extern int cache_cancel_lock(struct cacheitem *item); | 196 | extern int cache_cancel_lock(struct cacheitem *item); |
198 | extern int cache_exist(struct cacheitem *item); | 197 | extern int cache_exist(struct cacheitem *item); |
199 | extern int cache_expired(struct cacheitem *item); | 198 | extern int cache_expired(struct cacheitem *item); |
200 | 199 | ||
201 | extern char *cgit_repourl(const char *reponame); | 200 | extern char *cgit_repourl(const char *reponame); |
202 | extern char *cgit_pageurl(const char *reponame, const char *pagename, | 201 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
203 | const char *query); | 202 | const char *query); |
204 | 203 | ||
205 | extern void cgit_print_error(char *msg); | 204 | extern void cgit_print_error(char *msg); |
206 | extern void cgit_print_date(time_t secs, char *format); | 205 | extern void cgit_print_date(time_t secs, char *format); |
207 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); | 206 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); |
208 | extern void cgit_print_docstart(char *title, struct cacheitem *item); | 207 | extern void cgit_print_docstart(char *title, struct cacheitem *item); |
209 | extern void cgit_print_docend(); | 208 | extern void cgit_print_docend(); |
210 | extern void cgit_print_pageheader(char *title, int show_search); | 209 | extern void cgit_print_pageheader(char *title, int show_search); |
211 | extern void cgit_print_snapshot_start(const char *mimetype, | 210 | extern void cgit_print_snapshot_start(const char *mimetype, |
212 | const char *filename, | 211 | const char *filename, |
213 | struct cacheitem *item); | 212 | struct cacheitem *item); |
214 | 213 | ||
215 | extern void cgit_print_repolist(struct cacheitem *item); | 214 | extern void cgit_print_repolist(struct cacheitem *item); |
216 | extern void cgit_print_summary(); | 215 | extern void cgit_print_summary(); |
217 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); | 216 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); |
218 | extern void cgit_print_view(const char *hex, char *path); | ||
219 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); | 217 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
220 | extern void cgit_print_tree(const char *rev, const char *hex, char *path); | 218 | extern void cgit_print_tree(const char *rev, char *path); |
221 | extern void cgit_print_commit(const char *hex); | 219 | extern void cgit_print_commit(const char *hex); |
222 | extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, | 220 | extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, |
223 | char *path); | 221 | char *path); |
224 | extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, | 222 | extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, |
225 | const char *format, const char *prefix, | 223 | const char *format, const char *prefix, |
226 | const char *filename); | 224 | const char *filename); |
227 | 225 | ||
228 | #endif /* CGIT_H */ | 226 | #endif /* CGIT_H */ |