-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile | 21 | ||||
-rw-r--r-- | cgit-doc.css | 3 | ||||
-rw-r--r-- | cgit.c | 8 | ||||
-rw-r--r-- | cgit.h | 4 | ||||
-rw-r--r-- | cgitrc.5.txt | 120 | ||||
-rw-r--r-- | ui-atom.c | 6 | ||||
-rw-r--r-- | ui-blob.c | 8 | ||||
-rw-r--r-- | ui-plain.c | 4 | ||||
-rw-r--r-- | ui-shared.c | 26 | ||||
-rw-r--r-- | ui-shared.h | 1 | ||||
-rw-r--r-- | ui-snapshot.c | 23 | ||||
-rw-r--r-- | ui-tree.c | 16 |
13 files changed, 170 insertions, 75 deletions
@@ -1,6 +1,11 @@ | |||
1 | # Files I don't care to see in git-status/commit | 1 | # Files I don't care to see in git-status/commit |
2 | cgit | 2 | cgit |
3 | cgit.conf | 3 | cgit.conf |
4 | VERSION | 4 | VERSION |
5 | cgitrc.5 | ||
6 | cgitrc.5.fo | ||
7 | cgitrc.5.html | ||
8 | cgitrc.5.pdf | ||
9 | cgitrc.5.xml | ||
5 | *.o | 10 | *.o |
6 | *.d | 11 | *.d |
@@ -1,13 +1,13 @@ | |||
1 | CGIT_VERSION = v0.8.2 | 1 | CGIT_VERSION = v0.8.2.1 |
2 | CGIT_SCRIPT_NAME = cgit.cgi | 2 | CGIT_SCRIPT_NAME = cgit.cgi |
3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit | 3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit |
4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) | 4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) |
5 | CGIT_CONFIG = /etc/cgitrc | 5 | CGIT_CONFIG = /etc/cgitrc |
6 | CACHE_ROOT = /var/cache/cgit | 6 | CACHE_ROOT = /var/cache/cgit |
7 | SHA1_HEADER = <openssl/sha.h> | 7 | SHA1_HEADER = <openssl/sha.h> |
8 | GIT_VER = 1.6.1.1 | 8 | GIT_VER = 1.6.1.1 |
9 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 | 9 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 |
10 | INSTALL = install | 10 | INSTALL = install |
11 | 11 | ||
12 | # Define NO_STRCASESTR if you don't have strcasestr. | 12 | # Define NO_STRCASESTR if you don't have strcasestr. |
13 | # | 13 | # |
@@ -91,25 +91,26 @@ OBJECTS += ui-repolist.o | |||
91 | OBJECTS += ui-shared.o | 91 | OBJECTS += ui-shared.o |
92 | OBJECTS += ui-snapshot.o | 92 | OBJECTS += ui-snapshot.o |
93 | OBJECTS += ui-stats.o | 93 | OBJECTS += ui-stats.o |
94 | OBJECTS += ui-summary.o | 94 | OBJECTS += ui-summary.o |
95 | OBJECTS += ui-tag.o | 95 | OBJECTS += ui-tag.o |
96 | OBJECTS += ui-tree.o | 96 | OBJECTS += ui-tree.o |
97 | 97 | ||
98 | ifdef NEEDS_LIBICONV | 98 | ifdef NEEDS_LIBICONV |
99 | EXTLIBS += -liconv | 99 | EXTLIBS += -liconv |
100 | endif | 100 | endif |
101 | 101 | ||
102 | 102 | ||
103 | .PHONY: all libgit test install uninstall clean force-version get-git | 103 | .PHONY: all libgit test install uninstall clean force-version get-git \ |
104 | doc man-doc html-doc clean-doc | ||
104 | 105 | ||
105 | all: cgit | 106 | all: cgit |
106 | 107 | ||
107 | VERSION: force-version | 108 | VERSION: force-version |
108 | @./gen-version.sh "$(CGIT_VERSION)" | 109 | @./gen-version.sh "$(CGIT_VERSION)" |
109 | -include VERSION | 110 | -include VERSION |
110 | 111 | ||
111 | 112 | ||
112 | CFLAGS += -g -Wall -Igit | 113 | CFLAGS += -g -Wall -Igit |
113 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' | 114 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' |
114 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' | 115 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' |
115 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' | 116 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' |
@@ -140,17 +141,31 @@ test: all | |||
140 | install: all | 141 | install: all |
141 | $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH) | 142 | $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH) |
142 | $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) | 143 | $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) |
143 | $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH) | 144 | $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH) |
144 | $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css | 145 | $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css |
145 | $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png | 146 | $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png |
146 | 147 | ||
147 | uninstall: | 148 | uninstall: |
148 | rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) | 149 | rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) |
149 | rm -f $(CGIT_DATA_PATH)/cgit.css | 150 | rm -f $(CGIT_DATA_PATH)/cgit.css |
150 | rm -f $(CGIT_DATA_PATH)/cgit.png | 151 | rm -f $(CGIT_DATA_PATH)/cgit.png |
151 | 152 | ||
152 | clean: | 153 | doc: man-doc html-doc pdf-doc |
154 | |||
155 | man-doc: cgitrc.5.txt | ||
156 | a2x -f manpage cgitrc.5.txt | ||
157 | |||
158 | html-doc: cgitrc.5.txt | ||
159 | a2x -f xhtml --stylesheet=cgit-doc.css cgitrc.5.txt | ||
160 | |||
161 | pdf-doc: cgitrc.5.txt | ||
162 | a2x -f pdf cgitrc.5.txt | ||
163 | |||
164 | clean: clean-doc | ||
153 | rm -f cgit VERSION *.o *.d | 165 | rm -f cgit VERSION *.o *.d |
154 | 166 | ||
167 | clean-doc: | ||
168 | rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo | ||
169 | |||
155 | get-git: | 170 | get-git: |
156 | curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git | 171 | curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git |
diff --git a/cgit-doc.css b/cgit-doc.css new file mode 100644 index 0000000..5a399b6 --- a/dev/null +++ b/cgit-doc.css | |||
@@ -0,0 +1,3 @@ | |||
1 | div.variablelist dt { | ||
2 | margin-top: 1em; | ||
3 | } | ||
@@ -22,24 +22,26 @@ void config_cb(const char *name, const char *value) | |||
22 | if (!strcmp(name, "root-title")) | 22 | if (!strcmp(name, "root-title")) |
23 | ctx.cfg.root_title = xstrdup(value); | 23 | ctx.cfg.root_title = xstrdup(value); |
24 | else if (!strcmp(name, "root-desc")) | 24 | else if (!strcmp(name, "root-desc")) |
25 | ctx.cfg.root_desc = xstrdup(value); | 25 | ctx.cfg.root_desc = xstrdup(value); |
26 | else if (!strcmp(name, "root-readme")) | 26 | else if (!strcmp(name, "root-readme")) |
27 | ctx.cfg.root_readme = xstrdup(value); | 27 | ctx.cfg.root_readme = xstrdup(value); |
28 | else if (!strcmp(name, "css")) | 28 | else if (!strcmp(name, "css")) |
29 | ctx.cfg.css = xstrdup(value); | 29 | ctx.cfg.css = xstrdup(value); |
30 | else if (!strcmp(name, "favicon")) | 30 | else if (!strcmp(name, "favicon")) |
31 | ctx.cfg.favicon = xstrdup(value); | 31 | ctx.cfg.favicon = xstrdup(value); |
32 | else if (!strcmp(name, "footer")) | 32 | else if (!strcmp(name, "footer")) |
33 | ctx.cfg.footer = xstrdup(value); | 33 | ctx.cfg.footer = xstrdup(value); |
34 | else if (!strcmp(name, "head-include")) | ||
35 | ctx.cfg.head_include = xstrdup(value); | ||
34 | else if (!strcmp(name, "header")) | 36 | else if (!strcmp(name, "header")) |
35 | ctx.cfg.header = xstrdup(value); | 37 | ctx.cfg.header = xstrdup(value); |
36 | else if (!strcmp(name, "logo")) | 38 | else if (!strcmp(name, "logo")) |
37 | ctx.cfg.logo = xstrdup(value); | 39 | ctx.cfg.logo = xstrdup(value); |
38 | else if (!strcmp(name, "index-header")) | 40 | else if (!strcmp(name, "index-header")) |
39 | ctx.cfg.index_header = xstrdup(value); | 41 | ctx.cfg.index_header = xstrdup(value); |
40 | else if (!strcmp(name, "index-info")) | 42 | else if (!strcmp(name, "index-info")) |
41 | ctx.cfg.index_info = xstrdup(value); | 43 | ctx.cfg.index_info = xstrdup(value); |
42 | else if (!strcmp(name, "logo-link")) | 44 | else if (!strcmp(name, "logo-link")) |
43 | ctx.cfg.logo_link = xstrdup(value); | 45 | ctx.cfg.logo_link = xstrdup(value); |
44 | else if (!strcmp(name, "module-link")) | 46 | else if (!strcmp(name, "module-link")) |
45 | ctx.cfg.module_link = xstrdup(value); | 47 | ctx.cfg.module_link = xstrdup(value); |
@@ -201,24 +203,25 @@ static void prepare_context(struct cgit_context *ctx) | |||
201 | ctx->cfg.root_title = "Git repository browser"; | 203 | ctx->cfg.root_title = "Git repository browser"; |
202 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; | 204 | ctx->cfg.root_desc = "a fast webinterface for the git dscm"; |
203 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; | 205 | ctx->cfg.script_name = CGIT_SCRIPT_NAME; |
204 | ctx->cfg.summary_branches = 10; | 206 | ctx->cfg.summary_branches = 10; |
205 | ctx->cfg.summary_log = 10; | 207 | ctx->cfg.summary_log = 10; |
206 | ctx->cfg.summary_tags = 10; | 208 | ctx->cfg.summary_tags = 10; |
207 | ctx->page.mimetype = "text/html"; | 209 | ctx->page.mimetype = "text/html"; |
208 | ctx->page.charset = PAGE_ENCODING; | 210 | ctx->page.charset = PAGE_ENCODING; |
209 | ctx->page.filename = NULL; | 211 | ctx->page.filename = NULL; |
210 | ctx->page.size = 0; | 212 | ctx->page.size = 0; |
211 | ctx->page.modified = time(NULL); | 213 | ctx->page.modified = time(NULL); |
212 | ctx->page.expires = ctx->page.modified; | 214 | ctx->page.expires = ctx->page.modified; |
215 | ctx->page.etag = NULL; | ||
213 | } | 216 | } |
214 | 217 | ||
215 | struct refmatch { | 218 | struct refmatch { |
216 | char *req_ref; | 219 | char *req_ref; |
217 | char *first_ref; | 220 | char *first_ref; |
218 | int match; | 221 | int match; |
219 | }; | 222 | }; |
220 | 223 | ||
221 | int find_current_ref(const char *refname, const unsigned char *sha1, | 224 | int find_current_ref(const char *refname, const unsigned char *sha1, |
222 | int flags, void *cb_data) | 225 | int flags, void *cb_data) |
223 | { | 226 | { |
224 | struct refmatch *info; | 227 | struct refmatch *info; |
@@ -280,24 +283,26 @@ static int prepare_repo_cmd(struct cgit_context *ctx) | |||
280 | if (!ctx->qry.head) { | 283 | if (!ctx->qry.head) { |
281 | cgit_print_http_headers(ctx); | 284 | cgit_print_http_headers(ctx); |
282 | cgit_print_docstart(ctx); | 285 | cgit_print_docstart(ctx); |
283 | cgit_print_pageheader(ctx); | 286 | cgit_print_pageheader(ctx); |
284 | cgit_print_error("Repository seems to be empty"); | 287 | cgit_print_error("Repository seems to be empty"); |
285 | cgit_print_docend(); | 288 | cgit_print_docend(); |
286 | return 1; | 289 | return 1; |
287 | } | 290 | } |
288 | 291 | ||
289 | if (get_sha1(ctx->qry.head, sha1)) { | 292 | if (get_sha1(ctx->qry.head, sha1)) { |
290 | tmp = xstrdup(ctx->qry.head); | 293 | tmp = xstrdup(ctx->qry.head); |
291 | ctx->qry.head = ctx->repo->defbranch; | 294 | ctx->qry.head = ctx->repo->defbranch; |
295 | ctx->page.status = 404; | ||
296 | ctx->page.statusmsg = "not found"; | ||
292 | cgit_print_http_headers(ctx); | 297 | cgit_print_http_headers(ctx); |
293 | cgit_print_docstart(ctx); | 298 | cgit_print_docstart(ctx); |
294 | cgit_print_pageheader(ctx); | 299 | cgit_print_pageheader(ctx); |
295 | cgit_print_error(fmt("Invalid branch: %s", tmp)); | 300 | cgit_print_error(fmt("Invalid branch: %s", tmp)); |
296 | cgit_print_docend(); | 301 | cgit_print_docend(); |
297 | return 1; | 302 | return 1; |
298 | } | 303 | } |
299 | return 0; | 304 | return 0; |
300 | } | 305 | } |
301 | 306 | ||
302 | static void process_request(void *cbdata) | 307 | static void process_request(void *cbdata) |
303 | { | 308 | { |
@@ -424,24 +429,25 @@ static int calc_ttl() | |||
424 | if (ctx.qry.has_symref) | 429 | if (ctx.qry.has_symref) |
425 | return ctx.cfg.cache_dynamic_ttl; | 430 | return ctx.cfg.cache_dynamic_ttl; |
426 | 431 | ||
427 | if (ctx.qry.has_sha1) | 432 | if (ctx.qry.has_sha1) |
428 | return ctx.cfg.cache_static_ttl; | 433 | return ctx.cfg.cache_static_ttl; |
429 | 434 | ||
430 | return ctx.cfg.cache_repo_ttl; | 435 | return ctx.cfg.cache_repo_ttl; |
431 | } | 436 | } |
432 | 437 | ||
433 | int main(int argc, const char **argv) | 438 | int main(int argc, const char **argv) |
434 | { | 439 | { |
435 | const char *cgit_config_env = getenv("CGIT_CONFIG"); | 440 | const char *cgit_config_env = getenv("CGIT_CONFIG"); |
441 | const char *method = getenv("REQUEST_METHOD"); | ||
436 | const char *path; | 442 | const char *path; |
437 | char *qry; | 443 | char *qry; |
438 | int err, ttl; | 444 | int err, ttl; |
439 | 445 | ||
440 | prepare_context(&ctx); | 446 | prepare_context(&ctx); |
441 | cgit_repolist.length = 0; | 447 | cgit_repolist.length = 0; |
442 | cgit_repolist.count = 0; | 448 | cgit_repolist.count = 0; |
443 | cgit_repolist.repos = NULL; | 449 | cgit_repolist.repos = NULL; |
444 | 450 | ||
445 | if (getenv("SCRIPT_NAME")) | 451 | if (getenv("SCRIPT_NAME")) |
446 | ctx.cfg.script_name = xstrdup(getenv("SCRIPT_NAME")); | 452 | ctx.cfg.script_name = xstrdup(getenv("SCRIPT_NAME")); |
447 | if (getenv("QUERY_STRING")) | 453 | if (getenv("QUERY_STRING")) |
@@ -470,21 +476,23 @@ int main(int argc, const char **argv) | |||
470 | ctx.qry.url = xstrdup(path); | 476 | ctx.qry.url = xstrdup(path); |
471 | if (ctx.qry.raw) { | 477 | if (ctx.qry.raw) { |
472 | qry = ctx.qry.raw; | 478 | qry = ctx.qry.raw; |
473 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); | 479 | ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry)); |
474 | free(qry); | 480 | free(qry); |
475 | } else | 481 | } else |
476 | ctx.qry.raw = ctx.qry.url; | 482 | ctx.qry.raw = ctx.qry.url; |
477 | cgit_parse_url(ctx.qry.url); | 483 | cgit_parse_url(ctx.qry.url); |
478 | } | 484 | } |
479 | 485 | ||
480 | ttl = calc_ttl(); | 486 | ttl = calc_ttl(); |
481 | ctx.page.expires += ttl*60; | 487 | ctx.page.expires += ttl*60; |
488 | if (method && !strcmp(method, "HEAD")) | ||
489 | ctx.cfg.nocache = 1; | ||
482 | if (ctx.cfg.nocache) | 490 | if (ctx.cfg.nocache) |
483 | ctx.cfg.cache_size = 0; | 491 | ctx.cfg.cache_size = 0; |
484 | err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, | 492 | err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, |
485 | ctx.qry.raw, ttl, process_request, &ctx); | 493 | ctx.qry.raw, ttl, process_request, &ctx); |
486 | if (err) | 494 | if (err) |
487 | cgit_print_error(fmt("Error processing page: %s (%d)", | 495 | cgit_print_error(fmt("Error processing page: %s (%d)", |
488 | strerror(err), err)); | 496 | strerror(err), err)); |
489 | return err; | 497 | return err; |
490 | } | 498 | } |
@@ -127,24 +127,25 @@ struct cgit_query { | |||
127 | int nohead; | 127 | int nohead; |
128 | char *sort; | 128 | char *sort; |
129 | int showmsg; | 129 | int showmsg; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | struct cgit_config { | 132 | struct cgit_config { |
133 | char *agefile; | 133 | char *agefile; |
134 | char *cache_root; | 134 | char *cache_root; |
135 | char *clone_prefix; | 135 | char *clone_prefix; |
136 | char *css; | 136 | char *css; |
137 | char *favicon; | 137 | char *favicon; |
138 | char *footer; | 138 | char *footer; |
139 | char *head_include; | ||
139 | char *header; | 140 | char *header; |
140 | char *index_header; | 141 | char *index_header; |
141 | char *index_info; | 142 | char *index_info; |
142 | char *logo; | 143 | char *logo; |
143 | char *logo_link; | 144 | char *logo_link; |
144 | char *module_link; | 145 | char *module_link; |
145 | char *repo_group; | 146 | char *repo_group; |
146 | char *robots; | 147 | char *robots; |
147 | char *root_title; | 148 | char *root_title; |
148 | char *root_desc; | 149 | char *root_desc; |
149 | char *root_readme; | 150 | char *root_readme; |
150 | char *script_name; | 151 | char *script_name; |
@@ -173,25 +174,28 @@ struct cgit_config { | |||
173 | int summary_branches; | 174 | int summary_branches; |
174 | int summary_log; | 175 | int summary_log; |
175 | int summary_tags; | 176 | int summary_tags; |
176 | }; | 177 | }; |
177 | 178 | ||
178 | struct cgit_page { | 179 | struct cgit_page { |
179 | time_t modified; | 180 | time_t modified; |
180 | time_t expires; | 181 | time_t expires; |
181 | size_t size; | 182 | size_t size; |
182 | char *mimetype; | 183 | char *mimetype; |
183 | char *charset; | 184 | char *charset; |
184 | char *filename; | 185 | char *filename; |
186 | char *etag; | ||
185 | char *title; | 187 | char *title; |
188 | int status; | ||
189 | char *statusmsg; | ||
186 | }; | 190 | }; |
187 | 191 | ||
188 | struct cgit_context { | 192 | struct cgit_context { |
189 | struct cgit_query qry; | 193 | struct cgit_query qry; |
190 | struct cgit_config cfg; | 194 | struct cgit_config cfg; |
191 | struct cgit_repo *repo; | 195 | struct cgit_repo *repo; |
192 | struct cgit_page page; | 196 | struct cgit_page page; |
193 | }; | 197 | }; |
194 | 198 | ||
195 | struct cgit_snapshot_format { | 199 | struct cgit_snapshot_format { |
196 | const char *suffix; | 200 | const char *suffix; |
197 | const char *mimetype; | 201 | const char *mimetype; |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 771bb7d..a207fe0 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -1,282 +1,287 @@ | |||
1 | CGITRC | 1 | CGITRC(5) |
2 | ====== | 2 | ======== |
3 | 3 | ||
4 | 4 | ||
5 | NAME | 5 | NAME |
6 | ---- | 6 | ---- |
7 | cgitrc - runtime configuration for cgit | 7 | cgitrc - runtime configuration for cgit |
8 | 8 | ||
9 | 9 | ||
10 | DESCRIPTION | 10 | SYNOPSIS |
11 | ----------- | 11 | -------- |
12 | Cgitrc contains all runtime settings for cgit, including the list of git | 12 | Cgitrc contains all runtime settings for cgit, including the list of git |
13 | repositories, formatted as a line-separated list of NAME=VALUE pairs. Blank | 13 | repositories, formatted as a line-separated list of NAME=VALUE pairs. Blank |
14 | lines, and lines starting with '#', are ignored. | 14 | lines, and lines starting with '#', are ignored. |
15 | 15 | ||
16 | 16 | ||
17 | GLOBAL SETTINGS | 17 | GLOBAL SETTINGS |
18 | --------------- | 18 | --------------- |
19 | agefile | 19 | agefile:: |
20 | Specifies a path, relative to each repository path, which can be used | 20 | Specifies a path, relative to each repository path, which can be used |
21 | to specify the date and time of the youngest commit in the repository. | 21 | to specify the date and time of the youngest commit in the repository. |
22 | The first line in the file is used as input to the "parse_date" | 22 | The first line in the file is used as input to the "parse_date" |
23 | function in libgit. Recommended timestamp-format is "yyyy-mm-dd | 23 | function in libgit. Recommended timestamp-format is "yyyy-mm-dd |
24 | hh:mm:ss". Default value: "info/web/last-modified". | 24 | hh:mm:ss". Default value: "info/web/last-modified". |
25 | 25 | ||
26 | cache-root | 26 | cache-root:: |
27 | Path used to store the cgit cache entries. Default value: | 27 | Path used to store the cgit cache entries. Default value: |
28 | "/var/cache/cgit". | 28 | "/var/cache/cgit". |
29 | 29 | ||
30 | cache-dynamic-ttl | 30 | cache-dynamic-ttl:: |
31 | Number which specifies the time-to-live, in minutes, for the cached | 31 | Number which specifies the time-to-live, in minutes, for the cached |
32 | version of repository pages accessed without a fixed SHA1. Default | 32 | version of repository pages accessed without a fixed SHA1. Default |
33 | value: "5". | 33 | value: "5". |
34 | 34 | ||
35 | cache-repo-ttl | 35 | cache-repo-ttl:: |
36 | Number which specifies the time-to-live, in minutes, for the cached | 36 | Number which specifies the time-to-live, in minutes, for the cached |
37 | version of the repository summary page. Default value: "5". | 37 | version of the repository summary page. Default value: "5". |
38 | 38 | ||
39 | cache-root-ttl | 39 | cache-root-ttl:: |
40 | Number which specifies the time-to-live, in minutes, for the cached | 40 | Number which specifies the time-to-live, in minutes, for the cached |
41 | version of the repository index page. Default value: "5". | 41 | version of the repository index page. Default value: "5". |
42 | 42 | ||
43 | cache-size | 43 | cache-size:: |
44 | The maximum number of entries in the cgit cache. Default value: "0" | 44 | The maximum number of entries in the cgit cache. Default value: "0" |
45 | (i.e. caching is disabled). | 45 | (i.e. caching is disabled). |
46 | 46 | ||
47 | cache-static-ttl | 47 | cache-static-ttl:: |
48 | Number which specifies the time-to-live, in minutes, for the cached | 48 | Number which specifies the time-to-live, in minutes, for the cached |
49 | version of repository pages accessed with a fixed SHA1. Default value: | 49 | version of repository pages accessed with a fixed SHA1. Default value: |
50 | "5". | 50 | "5". |
51 | 51 | ||
52 | clone-prefix | 52 | clone-prefix:: |
53 | Space-separated list of common prefixes which, when combined with a | 53 | Space-separated list of common prefixes which, when combined with a |
54 | repository url, generates valid clone urls for the repository. This | 54 | repository url, generates valid clone urls for the repository. This |
55 | setting is only used if `repo.clone-url` is unspecified. Default value: | 55 | setting is only used if `repo.clone-url` is unspecified. Default value: |
56 | none. | 56 | none. |
57 | 57 | ||
58 | css | 58 | css:: |
59 | Url which specifies the css document to include in all cgit pages. | 59 | Url which specifies the css document to include in all cgit pages. |
60 | Default value: "/cgit.css". | 60 | Default value: "/cgit.css". |
61 | 61 | ||
62 | embedded | 62 | embedded:: |
63 | Flag which, when set to "1", will make cgit generate a html fragment | 63 | Flag which, when set to "1", will make cgit generate a html fragment |
64 | suitable for embedding in other html pages. Default value: none. See | 64 | suitable for embedding in other html pages. Default value: none. See |
65 | also: "noheader". | 65 | also: "noheader". |
66 | 66 | ||
67 | enable-index-links | 67 | enable-index-links:: |
68 | Flag which, when set to "1", will make cgit generate extra links for | 68 | Flag which, when set to "1", will make cgit generate extra links for |
69 | each repo in the repository index (specifically, to the "summary", | 69 | each repo in the repository index (specifically, to the "summary", |
70 | "commit" and "tree" pages). Default value: "0". | 70 | "commit" and "tree" pages). Default value: "0". |
71 | 71 | ||
72 | enable-log-filecount | 72 | enable-log-filecount:: |
73 | Flag which, when set to "1", will make cgit print the number of | 73 | Flag which, when set to "1", will make cgit print the number of |
74 | modified files for each commit on the repository log page. Default | 74 | modified files for each commit on the repository log page. Default |
75 | value: "0". | 75 | value: "0". |
76 | 76 | ||
77 | enable-log-linecount | 77 | enable-log-linecount:: |
78 | Flag which, when set to "1", will make cgit print the number of added | 78 | Flag which, when set to "1", will make cgit print the number of added |
79 | and removed lines for each commit on the repository log page. Default | 79 | and removed lines for each commit on the repository log page. Default |
80 | value: "0". | 80 | value: "0". |
81 | 81 | ||
82 | favicon | 82 | favicon:: |
83 | Url used as link to a shortcut icon for cgit. If specified, it is | 83 | Url used as link to a shortcut icon for cgit. If specified, it is |
84 | suggested to use the value "/favicon.ico" since certain browsers will | 84 | suggested to use the value "/favicon.ico" since certain browsers will |
85 | ignore other values. Default value: none. | 85 | ignore other values. Default value: none. |
86 | 86 | ||
87 | footer | 87 | footer:: |
88 | The content of the file specified with this option will be included | 88 | The content of the file specified with this option will be included |
89 | verbatim at the bottom of all pages (i.e. it replaces the standard | 89 | verbatim at the bottom of all pages (i.e. it replaces the standard |
90 | "generated by..." message. Default value: none. | 90 | "generated by..." message. Default value: none. |
91 | 91 | ||
92 | header | 92 | head-include:: |
93 | The content of the file specified with this option will be included | ||
94 | verbatim in the html HEAD section on all pages. Default value: none. | ||
95 | |||
96 | header:: | ||
93 | The content of the file specified with this option will be included | 97 | The content of the file specified with this option will be included |
94 | verbatim at the top of all pages. Default value: none. | 98 | verbatim at the top of all pages. Default value: none. |
95 | 99 | ||
96 | include | 100 | include:: |
97 | Name of a configfile to include before the rest of the current config- | 101 | Name of a configfile to include before the rest of the current config- |
98 | file is parsed. Default value: none. | 102 | file is parsed. Default value: none. |
99 | 103 | ||
100 | index-header | 104 | index-header:: |
101 | The content of the file specified with this option will be included | 105 | The content of the file specified with this option will be included |
102 | verbatim above the repository index. This setting is deprecated, and | 106 | verbatim above the repository index. This setting is deprecated, and |
103 | will not be supported by cgit-1.0 (use root-readme instead). Default | 107 | will not be supported by cgit-1.0 (use root-readme instead). Default |
104 | value: none. | 108 | value: none. |
105 | 109 | ||
106 | index-info | 110 | index-info:: |
107 | The content of the file specified with this option will be included | 111 | The content of the file specified with this option will be included |
108 | verbatim below the heading on the repository index page. This setting | 112 | verbatim below the heading on the repository index page. This setting |
109 | is deprecated, and will not be supported by cgit-1.0 (use root-desc | 113 | is deprecated, and will not be supported by cgit-1.0 (use root-desc |
110 | instead). Default value: none. | 114 | instead). Default value: none. |
111 | 115 | ||
112 | local-time | 116 | local-time:: |
113 | Flag which, if set to "1", makes cgit print commit and tag times in the | 117 | Flag which, if set to "1", makes cgit print commit and tag times in the |
114 | servers timezone. Default value: "0". | 118 | servers timezone. Default value: "0". |
115 | 119 | ||
116 | logo | 120 | logo:: |
117 | Url which specifies the source of an image which will be used as a logo | 121 | Url which specifies the source of an image which will be used as a logo |
118 | on all cgit pages. | 122 | on all cgit pages. |
119 | 123 | ||
120 | logo-link | 124 | logo-link:: |
121 | Url loaded when clicking on the cgit logo image. If unspecified the | 125 | Url loaded when clicking on the cgit logo image. If unspecified the |
122 | calculated url of the repository index page will be used. Default | 126 | calculated url of the repository index page will be used. Default |
123 | value: none. | 127 | value: none. |
124 | 128 | ||
125 | max-commit-count | 129 | max-commit-count:: |
126 | Specifies the number of entries to list per page in "log" view. Default | 130 | Specifies the number of entries to list per page in "log" view. Default |
127 | value: "50". | 131 | value: "50". |
128 | 132 | ||
129 | max-message-length | 133 | max-message-length:: |
130 | Specifies the maximum number of commit message characters to display in | 134 | Specifies the maximum number of commit message characters to display in |
131 | "log" view. Default value: "80". | 135 | "log" view. Default value: "80". |
132 | 136 | ||
133 | max-repo-count | 137 | max-repo-count:: |
134 | Specifies the number of entries to list per page on therepository | 138 | Specifies the number of entries to list per page on therepository |
135 | index page. Default value: "50". | 139 | index page. Default value: "50". |
136 | 140 | ||
137 | max-repodesc-length | 141 | max-repodesc-length:: |
138 | Specifies the maximum number of repo description characters to display | 142 | Specifies the maximum number of repo description characters to display |
139 | on the repository index page. Default value: "80". | 143 | on the repository index page. Default value: "80". |
140 | 144 | ||
141 | max-stats | 145 | max-stats:: |
142 | Set the default maximum statistics period. Valid values are "week", | 146 | Set the default maximum statistics period. Valid values are "week", |
143 | "month", "quarter" and "year". If unspecified, statistics are | 147 | "month", "quarter" and "year". If unspecified, statistics are |
144 | disabled. Default value: none. See also: "repo.max-stats". | 148 | disabled. Default value: none. See also: "repo.max-stats". |
145 | 149 | ||
146 | module-link | 150 | module-link:: |
147 | Text which will be used as the formatstring for a hyperlink when a | 151 | Text which will be used as the formatstring for a hyperlink when a |
148 | submodule is printed in a directory listing. The arguments for the | 152 | submodule is printed in a directory listing. The arguments for the |
149 | formatstring are the path and SHA1 of the submodule commit. Default | 153 | formatstring are the path and SHA1 of the submodule commit. Default |
150 | value: "./?repo=%s&page=commit&id=%s" | 154 | value: "./?repo=%s&page=commit&id=%s" |
151 | 155 | ||
152 | nocache | 156 | nocache:: |
153 | If set to the value "1" caching will be disabled. This settings is | 157 | If set to the value "1" caching will be disabled. This settings is |
154 | deprecated, and will not be honored starting with cgit-1.0. Default | 158 | deprecated, and will not be honored starting with cgit-1.0. Default |
155 | value: "0". | 159 | value: "0". |
156 | 160 | ||
157 | noheader | 161 | noheader:: |
158 | Flag which, when set to "1", will make cgit omit the standard header | 162 | Flag which, when set to "1", will make cgit omit the standard header |
159 | on all pages. Default value: none. See also: "embedded". | 163 | on all pages. Default value: none. See also: "embedded". |
160 | 164 | ||
161 | renamelimit | 165 | renamelimit:: |
162 | Maximum number of files to consider when detecting renames. The value | 166 | Maximum number of files to consider when detecting renames. The value |
163 | "-1" uses the compiletime value in git (for further info, look at | 167 | "-1" uses the compiletime value in git (for further info, look at |
164 | `man git-diff`). Default value: "-1". | 168 | `man git-diff`). Default value: "-1". |
165 | 169 | ||
166 | repo.group | 170 | repo.group:: |
167 | A value for the current repository group, which all repositories | 171 | A value for the current repository group, which all repositories |
168 | specified after this setting will inherit. Default value: none. | 172 | specified after this setting will inherit. Default value: none. |
169 | 173 | ||
170 | robots | 174 | robots:: |
171 | Text used as content for the "robots" meta-tag. Default value: | 175 | Text used as content for the "robots" meta-tag. Default value: |
172 | "index, nofollow". | 176 | "index, nofollow". |
173 | 177 | ||
174 | root-desc | 178 | root-desc:: |
175 | Text printed below the heading on the repository index page. Default | 179 | Text printed below the heading on the repository index page. Default |
176 | value: "a fast webinterface for the git dscm". | 180 | value: "a fast webinterface for the git dscm". |
177 | 181 | ||
178 | root-readme: | 182 | root-readme:: |
179 | The content of the file specified with this option will be included | 183 | The content of the file specified with this option will be included |
180 | verbatim below the "about" link on the repository index page. Default | 184 | verbatim below the "about" link on the repository index page. Default |
181 | value: none. | 185 | value: none. |
182 | 186 | ||
183 | root-title | 187 | root-title:: |
184 | Text printed as heading on the repository index page. Default value: | 188 | Text printed as heading on the repository index page. Default value: |
185 | "Git Repository Browser". | 189 | "Git Repository Browser". |
186 | 190 | ||
187 | snapshots | 191 | snapshots:: |
188 | Text which specifies the default (and allowed) set of snapshot formats | 192 | Text which specifies the default (and allowed) set of snapshot formats |
189 | supported by cgit. The value is a space-separated list of zero or more | 193 | supported by cgit. The value is a space-separated list of zero or more |
190 | of the following values: | 194 | of the following values: |
191 | "tar" uncompressed tar-file | 195 | "tar" uncompressed tar-file |
192 | "tar.gz"gzip-compressed tar-file | 196 | "tar.gz"gzip-compressed tar-file |
193 | "tar.bz2"bzip-compressed tar-file | 197 | "tar.bz2"bzip-compressed tar-file |
194 | "zip" zip-file | 198 | "zip" zip-file |
195 | Default value: none. | 199 | Default value: none. |
196 | 200 | ||
197 | summary-branches | 201 | summary-branches:: |
198 | Specifies the number of branches to display in the repository "summary" | 202 | Specifies the number of branches to display in the repository "summary" |
199 | view. Default value: "10". | 203 | view. Default value: "10". |
200 | 204 | ||
201 | summary-log | 205 | summary-log:: |
202 | Specifies the number of log entries to display in the repository | 206 | Specifies the number of log entries to display in the repository |
203 | "summary" view. Default value: "10". | 207 | "summary" view. Default value: "10". |
204 | 208 | ||
205 | summary-tags | 209 | summary-tags:: |
206 | Specifies the number of tags to display in the repository "summary" | 210 | Specifies the number of tags to display in the repository "summary" |
207 | view. Default value: "10". | 211 | view. Default value: "10". |
208 | 212 | ||
209 | virtual-root | 213 | virtual-root:: |
210 | Url which, if specified, will be used as root for all cgit links. It | 214 | Url which, if specified, will be used as root for all cgit links. It |
211 | will also cause cgit to generate 'virtual urls', i.e. urls like | 215 | will also cause cgit to generate 'virtual urls', i.e. urls like |
212 | '/cgit/tree/README' as opposed to '?r=cgit&p=tree&path=README'. Default | 216 | '/cgit/tree/README' as opposed to '?r=cgit&p=tree&path=README'. Default |
213 | value: none. | 217 | value: none. |
214 | NOTE: cgit has recently learned how to use PATH_INFO to achieve the | 218 | NOTE: cgit has recently learned how to use PATH_INFO to achieve the |
215 | same kind of virtual urls, so this option will probably be deprecated. | 219 | same kind of virtual urls, so this option will probably be deprecated. |
216 | 220 | ||
217 | REPOSITORY SETTINGS | 221 | REPOSITORY SETTINGS |
218 | ------------------- | 222 | ------------------- |
219 | repo.clone-url | 223 | repo.clone-url:: |
220 | A list of space-separated urls which can be used to clone this repo. | 224 | A list of space-separated urls which can be used to clone this repo. |
221 | Default value: none. | 225 | Default value: none. |
222 | 226 | ||
223 | repo.defbranch | 227 | repo.defbranch:: |
224 | The name of the default branch for this repository. If no such branch | 228 | The name of the default branch for this repository. If no such branch |
225 | exists in the repository, the first branch name (when sorted) is used | 229 | exists in the repository, the first branch name (when sorted) is used |
226 | as default instead. Default value: "master". | 230 | as default instead. Default value: "master". |
227 | 231 | ||
228 | repo.desc | 232 | repo.desc:: |
229 | The value to show as repository description. Default value: none. | 233 | The value to show as repository description. Default value: none. |
230 | 234 | ||
231 | repo.enable-log-filecount | 235 | repo.enable-log-filecount:: |
232 | A flag which can be used to disable the global setting | 236 | A flag which can be used to disable the global setting |
233 | `enable-log-filecount'. Default value: none. | 237 | `enable-log-filecount'. Default value: none. |
234 | 238 | ||
235 | repo.enable-log-linecount | 239 | repo.enable-log-linecount:: |
236 | A flag which can be used to disable the global setting | 240 | A flag which can be used to disable the global setting |
237 | `enable-log-linecount'. Default value: none. | 241 | `enable-log-linecount'. Default value: none. |
238 | 242 | ||
239 | repo.max-stats | 243 | repo.max-stats:: |
240 | Override the default maximum statistics period. Valid values are equal | 244 | Override the default maximum statistics period. Valid values are equal |
241 | to the values specified for the global "max-stats" setting. Default | 245 | to the values specified for the global "max-stats" setting. Default |
242 | value: none. | 246 | value: none. |
243 | 247 | ||
244 | repo.name | 248 | repo.name:: |
245 | The value to show as repository name. Default value: <repo.url>. | 249 | The value to show as repository name. Default value: <repo.url>. |
246 | 250 | ||
247 | repo.owner | 251 | repo.owner:: |
248 | A value used to identify the owner of the repository. Default value: | 252 | A value used to identify the owner of the repository. Default value: |
249 | none. | 253 | none. |
250 | 254 | ||
251 | repo.path | 255 | repo.path:: |
252 | An absolute path to the repository directory. For non-bare repositories | 256 | An absolute path to the repository directory. For non-bare repositories |
253 | this is the .git-directory. Default value: none. | 257 | this is the .git-directory. Default value: none. |
254 | 258 | ||
255 | repo.readme | 259 | repo.readme:: |
256 | A path (relative to <repo.path>) which specifies a file to include | 260 | A path (relative to <repo.path>) which specifies a file to include |
257 | verbatim as the "About" page for this repo. Default value: none. | 261 | verbatim as the "About" page for this repo. Default value: none. |
258 | 262 | ||
259 | repo.snapshots | 263 | repo.snapshots:: |
260 | A mask of allowed snapshot-formats for this repo, restricted by the | 264 | A mask of allowed snapshot-formats for this repo, restricted by the |
261 | "snapshots" global setting. Default value: <snapshots>. | 265 | "snapshots" global setting. Default value: <snapshots>. |
262 | 266 | ||
263 | repo.url | 267 | repo.url:: |
264 | The relative url used to access the repository. This must be the first | 268 | The relative url used to access the repository. This must be the first |
265 | setting specified for each repo. Default value: none. | 269 | setting specified for each repo. Default value: none. |
266 | 270 | ||
267 | 271 | ||
268 | EXAMPLE CGITRC FILE | 272 | EXAMPLE CGITRC FILE |
269 | ------------------- | 273 | ------------------- |
270 | 274 | ||
275 | .... | ||
271 | # Enable caching of up to 1000 output entriess | 276 | # Enable caching of up to 1000 output entriess |
272 | cache-size=1000 | 277 | cache-size=1000 |
273 | 278 | ||
274 | 279 | ||
275 | # Specify some default clone prefixes | 280 | # Specify some default clone prefixes |
276 | clone-prefix=git://foobar.com ssh://foobar.com/pub/git http://foobar.com/git | 281 | clone-prefix=git://foobar.com ssh://foobar.com/pub/git http://foobar.com/git |
277 | 282 | ||
278 | # Specify the css url | 283 | # Specify the css url |
279 | css=/css/cgit.css | 284 | css=/css/cgit.css |
280 | 285 | ||
281 | 286 | ||
282 | # Show extra links for each repository on the index page | 287 | # Show extra links for each repository on the index page |
@@ -368,24 +373,25 @@ repo.desc=the dscm | |||
368 | repo.url=linux | 373 | repo.url=linux |
369 | repo.path=/pub/git/linux.git | 374 | repo.path=/pub/git/linux.git |
370 | repo.desc=the kernel | 375 | repo.desc=the kernel |
371 | 376 | ||
372 | # Disable adhoc downloads of this repo | 377 | # Disable adhoc downloads of this repo |
373 | repo.snapshots=0 | 378 | repo.snapshots=0 |
374 | 379 | ||
375 | # Disable line-counts for this repo | 380 | # Disable line-counts for this repo |
376 | repo.enable-log-linecount=0 | 381 | repo.enable-log-linecount=0 |
377 | 382 | ||
378 | # Restrict the max statistics period for this repo | 383 | # Restrict the max statistics period for this repo |
379 | repo.max-stats=month | 384 | repo.max-stats=month |
385 | .... | ||
380 | 386 | ||
381 | 387 | ||
382 | BUGS | 388 | BUGS |
383 | ---- | 389 | ---- |
384 | Comments currently cannot appear on the same line as a setting; the comment | 390 | Comments currently cannot appear on the same line as a setting; the comment |
385 | will be included as part of the value. E.g. this line: | 391 | will be included as part of the value. E.g. this line: |
386 | 392 | ||
387 | robots=index # allow indexing | 393 | robots=index # allow indexing |
388 | 394 | ||
389 | will generate the following html element: | 395 | will generate the following html element: |
390 | 396 | ||
391 | <meta name='robots' content='index # allow indexing'/> | 397 | <meta name='robots' content='index # allow indexing'/> |
@@ -43,25 +43,26 @@ void add_entry(struct commit *commit, char *host) | |||
43 | if (t2) | 43 | if (t2) |
44 | *t2 = '\0'; | 44 | *t2 = '\0'; |
45 | html("<email>"); | 45 | html("<email>"); |
46 | html_txt(t); | 46 | html_txt(t); |
47 | html("</email>\n"); | 47 | html("</email>\n"); |
48 | free(mail); | 48 | free(mail); |
49 | } | 49 | } |
50 | html("</author>\n"); | 50 | html("</author>\n"); |
51 | html("<published>"); | 51 | html("<published>"); |
52 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); | 52 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); |
53 | html("</published>\n"); | 53 | html("</published>\n"); |
54 | if (host) { | 54 | if (host) { |
55 | html("<link rel='alternate' type='text/html' href='http://"); | 55 | html("<link rel='alternate' type='text/html' href='"); |
56 | html(cgit_httpscheme()); | ||
56 | html_attr(host); | 57 | html_attr(host); |
57 | html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL)); | 58 | html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL)); |
58 | if (ctx.cfg.virtual_root) | 59 | if (ctx.cfg.virtual_root) |
59 | delim = '?'; | 60 | delim = '?'; |
60 | htmlf("%cid=%s", delim, hex); | 61 | htmlf("%cid=%s", delim, hex); |
61 | html("'/>\n"); | 62 | html("'/>\n"); |
62 | } | 63 | } |
63 | htmlf("<id>%s</id>\n", hex); | 64 | htmlf("<id>%s</id>\n", hex); |
64 | html("<content type='text'>\n"); | 65 | html("<content type='text'>\n"); |
65 | html_txt(info->msg); | 66 | html_txt(info->msg); |
66 | html("</content>\n"); | 67 | html("</content>\n"); |
67 | html("<content type='xhtml'>\n"); | 68 | html("<content type='xhtml'>\n"); |
@@ -104,25 +105,26 @@ void cgit_print_atom(char *tip, char *path, int max_count) | |||
104 | host = cgit_hosturl(); | 105 | host = cgit_hosturl(); |
105 | ctx.page.mimetype = "text/xml"; | 106 | ctx.page.mimetype = "text/xml"; |
106 | ctx.page.charset = "utf-8"; | 107 | ctx.page.charset = "utf-8"; |
107 | cgit_print_http_headers(&ctx); | 108 | cgit_print_http_headers(&ctx); |
108 | html("<feed xmlns='http://www.w3.org/2005/Atom'>\n"); | 109 | html("<feed xmlns='http://www.w3.org/2005/Atom'>\n"); |
109 | html("<title>"); | 110 | html("<title>"); |
110 | html_txt(ctx.repo->name); | 111 | html_txt(ctx.repo->name); |
111 | html("</title>\n"); | 112 | html("</title>\n"); |
112 | html("<subtitle>"); | 113 | html("<subtitle>"); |
113 | html_txt(ctx.repo->desc); | 114 | html_txt(ctx.repo->desc); |
114 | html("</subtitle>\n"); | 115 | html("</subtitle>\n"); |
115 | if (host) { | 116 | if (host) { |
116 | html("<link rel='alternate' type='text/html' href='http://"); | 117 | html("<link rel='alternate' type='text/html' href='"); |
118 | html(cgit_httpscheme()); | ||
117 | html_attr(host); | 119 | html_attr(host); |
118 | html_attr(cgit_repourl(ctx.repo->url)); | 120 | html_attr(cgit_repourl(ctx.repo->url)); |
119 | html("'/>\n"); | 121 | html("'/>\n"); |
120 | } | 122 | } |
121 | while ((commit = get_revision(&rev)) != NULL) { | 123 | while ((commit = get_revision(&rev)) != NULL) { |
122 | add_entry(commit, host); | 124 | add_entry(commit, host); |
123 | free(commit->buffer); | 125 | free(commit->buffer); |
124 | commit->buffer = NULL; | 126 | commit->buffer = NULL; |
125 | free_commit_list(commit->parents); | 127 | free_commit_list(commit->parents); |
126 | commit->parents = NULL; | 128 | commit->parents = NULL; |
127 | } | 129 | } |
128 | html("</feed>\n"); | 130 | html("</feed>\n"); |
@@ -18,25 +18,25 @@ static int walk_tree(const unsigned char *sha1, const char *base,int baselen, | |||
18 | if(strncmp(base,match_path,baselen) | 18 | if(strncmp(base,match_path,baselen) |
19 | || strcmp(match_path+baselen,pathname) ) | 19 | || strcmp(match_path+baselen,pathname) ) |
20 | return READ_TREE_RECURSIVE; | 20 | return READ_TREE_RECURSIVE; |
21 | memmove(matched_sha1,sha1,20); | 21 | memmove(matched_sha1,sha1,20); |
22 | return 0; | 22 | return 0; |
23 | } | 23 | } |
24 | 24 | ||
25 | void cgit_print_blob(const char *hex, char *path, const char *head) | 25 | void cgit_print_blob(const char *hex, char *path, const char *head) |
26 | { | 26 | { |
27 | 27 | ||
28 | unsigned char sha1[20]; | 28 | unsigned char sha1[20]; |
29 | enum object_type type; | 29 | enum object_type type; |
30 | unsigned char *buf; | 30 | char *buf; |
31 | unsigned long size; | 31 | unsigned long size; |
32 | struct commit *commit; | 32 | struct commit *commit; |
33 | const char *paths[] = {path, NULL}; | 33 | const char *paths[] = {path, NULL}; |
34 | 34 | ||
35 | if (hex) { | 35 | if (hex) { |
36 | if (get_sha1_hex(hex, sha1)){ | 36 | if (get_sha1_hex(hex, sha1)){ |
37 | cgit_print_error(fmt("Bad hex value: %s", hex)); | 37 | cgit_print_error(fmt("Bad hex value: %s", hex)); |
38 | return; | 38 | return; |
39 | } | 39 | } |
40 | } else { | 40 | } else { |
41 | if (get_sha1(head,sha1)) { | 41 | if (get_sha1(head,sha1)) { |
42 | cgit_print_error(fmt("Bad ref: %s", head)); | 42 | cgit_print_error(fmt("Bad ref: %s", head)); |
@@ -58,16 +58,22 @@ void cgit_print_blob(const char *hex, char *path, const char *head) | |||
58 | cgit_print_error(fmt("Bad object name: %s", hex)); | 58 | cgit_print_error(fmt("Bad object name: %s", hex)); |
59 | return; | 59 | return; |
60 | } | 60 | } |
61 | 61 | ||
62 | buf = read_sha1_file(sha1, &type, &size); | 62 | buf = read_sha1_file(sha1, &type, &size); |
63 | if (!buf) { | 63 | if (!buf) { |
64 | cgit_print_error(fmt("Error reading object %s", hex)); | 64 | cgit_print_error(fmt("Error reading object %s", hex)); |
65 | return; | 65 | return; |
66 | } | 66 | } |
67 | 67 | ||
68 | buf[size] = '\0'; | 68 | buf[size] = '\0'; |
69 | ctx.page.mimetype = ctx.qry.mimetype; | 69 | ctx.page.mimetype = ctx.qry.mimetype; |
70 | if (!ctx.page.mimetype) { | ||
71 | if (buffer_is_binary(buf, size)) | ||
72 | ctx.page.mimetype = "application/octet-stream"; | ||
73 | else | ||
74 | ctx.page.mimetype = "text/plain"; | ||
75 | } | ||
70 | ctx.page.filename = path; | 76 | ctx.page.filename = path; |
71 | cgit_print_http_headers(&ctx); | 77 | cgit_print_http_headers(&ctx); |
72 | write(htmlfd, buf, size); | 78 | write(htmlfd, buf, size); |
73 | } | 79 | } |
@@ -22,27 +22,31 @@ static void print_object(const unsigned char *sha1, const char *path) | |||
22 | 22 | ||
23 | type = sha1_object_info(sha1, &size); | 23 | type = sha1_object_info(sha1, &size); |
24 | if (type == OBJ_BAD) { | 24 | if (type == OBJ_BAD) { |
25 | html_status(404, "Not found", 0); | 25 | html_status(404, "Not found", 0); |
26 | return; | 26 | return; |
27 | } | 27 | } |
28 | 28 | ||
29 | buf = read_sha1_file(sha1, &type, &size); | 29 | buf = read_sha1_file(sha1, &type, &size); |
30 | if (!buf) { | 30 | if (!buf) { |
31 | html_status(404, "Not found", 0); | 31 | html_status(404, "Not found", 0); |
32 | return; | 32 | return; |
33 | } | 33 | } |
34 | if (buffer_is_binary(buf, size)) | ||
35 | ctx.page.mimetype = "application/octet-stream"; | ||
36 | else | ||
34 | ctx.page.mimetype = "text/plain"; | 37 | ctx.page.mimetype = "text/plain"; |
35 | ctx.page.filename = fmt("%s", path); | 38 | ctx.page.filename = fmt("%s", path); |
36 | ctx.page.size = size; | 39 | ctx.page.size = size; |
40 | ctx.page.etag = sha1_to_hex(sha1); | ||
37 | cgit_print_http_headers(&ctx); | 41 | cgit_print_http_headers(&ctx); |
38 | html_raw(buf, size); | 42 | html_raw(buf, size); |
39 | match = 1; | 43 | match = 1; |
40 | } | 44 | } |
41 | 45 | ||
42 | static int walk_tree(const unsigned char *sha1, const char *base, int baselen, | 46 | static int walk_tree(const unsigned char *sha1, const char *base, int baselen, |
43 | const char *pathname, unsigned mode, int stage, | 47 | const char *pathname, unsigned mode, int stage, |
44 | void *cbdata) | 48 | void *cbdata) |
45 | { | 49 | { |
46 | if (S_ISDIR(mode)) | 50 | if (S_ISDIR(mode)) |
47 | return READ_TREE_RECURSIVE; | 51 | return READ_TREE_RECURSIVE; |
48 | 52 | ||
diff --git a/ui-shared.c b/ui-shared.c index 5e03a7a..015c52b 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -25,24 +25,35 @@ static char *http_date(time_t t) | |||
25 | return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday], | 25 | return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday], |
26 | tm->tm_mday, month[tm->tm_mon], 1900+tm->tm_year, | 26 | tm->tm_mday, month[tm->tm_mon], 1900+tm->tm_year, |
27 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 27 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
28 | } | 28 | } |
29 | 29 | ||
30 | void cgit_print_error(char *msg) | 30 | void cgit_print_error(char *msg) |
31 | { | 31 | { |
32 | html("<div class='error'>"); | 32 | html("<div class='error'>"); |
33 | html_txt(msg); | 33 | html_txt(msg); |
34 | html("</div>\n"); | 34 | html("</div>\n"); |
35 | } | 35 | } |
36 | 36 | ||
37 | char *cgit_httpscheme() | ||
38 | { | ||
39 | char *https; | ||
40 | |||
41 | https = getenv("HTTPS"); | ||
42 | if (https != NULL && strcmp(https, "on") == 0) | ||
43 | return "https://"; | ||
44 | else | ||
45 | return "http://"; | ||
46 | } | ||
47 | |||
37 | char *cgit_hosturl() | 48 | char *cgit_hosturl() |
38 | { | 49 | { |
39 | char *host, *port; | 50 | char *host, *port; |
40 | 51 | ||
41 | host = getenv("HTTP_HOST"); | 52 | host = getenv("HTTP_HOST"); |
42 | if (host) { | 53 | if (host) { |
43 | host = xstrdup(host); | 54 | host = xstrdup(host); |
44 | } else { | 55 | } else { |
45 | host = getenv("SERVER_NAME"); | 56 | host = getenv("SERVER_NAME"); |
46 | if (!host) | 57 | if (!host) |
47 | return NULL; | 58 | return NULL; |
48 | port = getenv("SERVER_PORT"); | 59 | port = getenv("SERVER_PORT"); |
@@ -447,40 +458,48 @@ void cgit_print_age(time_t t, time_t max_relative, char *format) | |||
447 | } | 458 | } |
448 | if (secs < TM_YEAR * 2) { | 459 | if (secs < TM_YEAR * 2) { |
449 | htmlf("<span class='age-months'>%.0f months</span>", | 460 | htmlf("<span class='age-months'>%.0f months</span>", |
450 | secs * 1.0 / TM_MONTH); | 461 | secs * 1.0 / TM_MONTH); |
451 | return; | 462 | return; |
452 | } | 463 | } |
453 | htmlf("<span class='age-years'>%.0f years</span>", | 464 | htmlf("<span class='age-years'>%.0f years</span>", |
454 | secs * 1.0 / TM_YEAR); | 465 | secs * 1.0 / TM_YEAR); |
455 | } | 466 | } |
456 | 467 | ||
457 | void cgit_print_http_headers(struct cgit_context *ctx) | 468 | void cgit_print_http_headers(struct cgit_context *ctx) |
458 | { | 469 | { |
470 | const char *method = getenv("REQUEST_METHOD"); | ||
471 | |||
459 | if (ctx->cfg.embedded) | 472 | if (ctx->cfg.embedded) |
460 | return; | 473 | return; |
461 | 474 | ||
475 | if (ctx->page.status) | ||
476 | htmlf("Status: %d %s\n", ctx->page.status, ctx->page.statusmsg); | ||
462 | if (ctx->page.mimetype && ctx->page.charset) | 477 | if (ctx->page.mimetype && ctx->page.charset) |
463 | htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype, | 478 | htmlf("Content-Type: %s; charset=%s\n", ctx->page.mimetype, |
464 | ctx->page.charset); | 479 | ctx->page.charset); |
465 | else if (ctx->page.mimetype) | 480 | else if (ctx->page.mimetype) |
466 | htmlf("Content-Type: %s\n", ctx->page.mimetype); | 481 | htmlf("Content-Type: %s\n", ctx->page.mimetype); |
467 | if (ctx->page.size) | 482 | if (ctx->page.size) |
468 | htmlf("Content-Length: %ld\n", ctx->page.size); | 483 | htmlf("Content-Length: %ld\n", ctx->page.size); |
469 | if (ctx->page.filename) | 484 | if (ctx->page.filename) |
470 | htmlf("Content-Disposition: inline; filename=\"%s\"\n", | 485 | htmlf("Content-Disposition: inline; filename=\"%s\"\n", |
471 | ctx->page.filename); | 486 | ctx->page.filename); |
472 | htmlf("Last-Modified: %s\n", http_date(ctx->page.modified)); | 487 | htmlf("Last-Modified: %s\n", http_date(ctx->page.modified)); |
473 | htmlf("Expires: %s\n", http_date(ctx->page.expires)); | 488 | htmlf("Expires: %s\n", http_date(ctx->page.expires)); |
489 | if (ctx->page.etag) | ||
490 | htmlf("ETag: \"%s\"\n", ctx->page.etag); | ||
474 | html("\n"); | 491 | html("\n"); |
492 | if (method && !strcmp(method, "HEAD")) | ||
493 | exit(0); | ||
475 | } | 494 | } |
476 | 495 | ||
477 | void cgit_print_docstart(struct cgit_context *ctx) | 496 | void cgit_print_docstart(struct cgit_context *ctx) |
478 | { | 497 | { |
479 | if (ctx->cfg.embedded) | 498 | if (ctx->cfg.embedded) |
480 | return; | 499 | return; |
481 | 500 | ||
482 | char *host = cgit_hosturl(); | 501 | char *host = cgit_hosturl(); |
483 | html(cgit_doctype); | 502 | html(cgit_doctype); |
484 | html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); | 503 | html("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n"); |
485 | html("<head>\n"); | 504 | html("<head>\n"); |
486 | html("<title>"); | 505 | html("<title>"); |
@@ -489,30 +508,33 @@ void cgit_print_docstart(struct cgit_context *ctx) | |||
489 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); | 508 | htmlf("<meta name='generator' content='cgit %s'/>\n", cgit_version); |
490 | if (ctx->cfg.robots && *ctx->cfg.robots) | 509 | if (ctx->cfg.robots && *ctx->cfg.robots) |
491 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); | 510 | htmlf("<meta name='robots' content='%s'/>\n", ctx->cfg.robots); |
492 | html("<link rel='stylesheet' type='text/css' href='"); | 511 | html("<link rel='stylesheet' type='text/css' href='"); |
493 | html_attr(ctx->cfg.css); | 512 | html_attr(ctx->cfg.css); |
494 | html("'/>\n"); | 513 | html("'/>\n"); |
495 | if (ctx->cfg.favicon) { | 514 | if (ctx->cfg.favicon) { |
496 | html("<link rel='shortcut icon' href='"); | 515 | html("<link rel='shortcut icon' href='"); |
497 | html_attr(ctx->cfg.favicon); | 516 | html_attr(ctx->cfg.favicon); |
498 | html("'/>\n"); | 517 | html("'/>\n"); |
499 | } | 518 | } |
500 | if (host && ctx->repo) { | 519 | if (host && ctx->repo) { |
501 | html("<link rel='alternate' title='Atom feed' href='http://"); | 520 | html("<link rel='alternate' title='Atom feed' href='"); |
521 | html(cgit_httpscheme()); | ||
502 | html_attr(cgit_hosturl()); | 522 | html_attr(cgit_hosturl()); |
503 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, | 523 | html_attr(cgit_fileurl(ctx->repo->url, "atom", ctx->qry.path, |
504 | fmt("h=%s", ctx->qry.head))); | 524 | fmt("h=%s", ctx->qry.head))); |
505 | html("' type='application/atom+xml'/>"); | 525 | html("' type='application/atom+xml'/>\n"); |
506 | } | 526 | } |
527 | if (ctx->cfg.head_include) | ||
528 | html_include(ctx->cfg.head_include); | ||
507 | html("</head>\n"); | 529 | html("</head>\n"); |
508 | html("<body>\n"); | 530 | html("<body>\n"); |
509 | if (ctx->cfg.header) | 531 | if (ctx->cfg.header) |
510 | html_include(ctx->cfg.header); | 532 | html_include(ctx->cfg.header); |
511 | } | 533 | } |
512 | 534 | ||
513 | void cgit_print_docend() | 535 | void cgit_print_docend() |
514 | { | 536 | { |
515 | html("</div>"); | 537 | html("</div>"); |
516 | if (ctx.cfg.footer) | 538 | if (ctx.cfg.footer) |
517 | html_include(ctx.cfg.footer); | 539 | html_include(ctx.cfg.footer); |
518 | else { | 540 | else { |
diff --git a/ui-shared.h b/ui-shared.h index 5a3821f..bff4826 100644 --- a/ui-shared.h +++ b/ui-shared.h | |||
@@ -1,15 +1,16 @@ | |||
1 | #ifndef UI_SHARED_H | 1 | #ifndef UI_SHARED_H |
2 | #define UI_SHARED_H | 2 | #define UI_SHARED_H |
3 | 3 | ||
4 | extern char *cgit_httpscheme(); | ||
4 | extern char *cgit_hosturl(); | 5 | extern char *cgit_hosturl(); |
5 | extern char *cgit_repourl(const char *reponame); | 6 | extern char *cgit_repourl(const char *reponame); |
6 | extern char *cgit_fileurl(const char *reponame, const char *pagename, | 7 | extern char *cgit_fileurl(const char *reponame, const char *pagename, |
7 | const char *filename, const char *query); | 8 | const char *filename, const char *query); |
8 | extern char *cgit_pageurl(const char *reponame, const char *pagename, | 9 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
9 | const char *query); | 10 | const char *query); |
10 | 11 | ||
11 | extern void cgit_index_link(char *name, char *title, char *class, | 12 | extern void cgit_index_link(char *name, char *title, char *class, |
12 | char *pattern, int ofs); | 13 | char *pattern, int ofs); |
13 | extern void cgit_summary_link(char *name, char *title, char *class, char *head); | 14 | extern void cgit_summary_link(char *name, char *title, char *class, char *head); |
14 | extern void cgit_tag_link(char *name, char *title, char *class, char *head, | 15 | extern void cgit_tag_link(char *name, char *title, char *class, char *head, |
15 | char *rev); | 16 | char *rev); |
diff --git a/ui-snapshot.c b/ui-snapshot.c index f25613e..5372f5d 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c | |||
@@ -147,38 +147,49 @@ static const char *get_ref_from_filename(const char *url, const char *filename, | |||
147 | } | 147 | } |
148 | 148 | ||
149 | if (get_sha1(snapshot, sha1) == 0) | 149 | if (get_sha1(snapshot, sha1) == 0) |
150 | return snapshot; | 150 | return snapshot; |
151 | 151 | ||
152 | snapshot = fmt("v%s", snapshot); | 152 | snapshot = fmt("v%s", snapshot); |
153 | if (get_sha1(snapshot, sha1) == 0) | 153 | if (get_sha1(snapshot, sha1) == 0) |
154 | return snapshot; | 154 | return snapshot; |
155 | 155 | ||
156 | return NULL; | 156 | return NULL; |
157 | } | 157 | } |
158 | 158 | ||
159 | void show_error(char *msg) | ||
160 | { | ||
161 | ctx.page.mimetype = "text/html"; | ||
162 | cgit_print_http_headers(&ctx); | ||
163 | cgit_print_docstart(&ctx); | ||
164 | cgit_print_pageheader(&ctx); | ||
165 | cgit_print_error(msg); | ||
166 | cgit_print_docend(); | ||
167 | } | ||
168 | |||
159 | void cgit_print_snapshot(const char *head, const char *hex, | 169 | void cgit_print_snapshot(const char *head, const char *hex, |
160 | const char *filename, int snapshots, int dwim) | 170 | const char *filename, int snapshots, int dwim) |
161 | { | 171 | { |
162 | const struct cgit_snapshot_format* f; | 172 | const struct cgit_snapshot_format* f; |
163 | char *prefix = NULL; | 173 | char *prefix = NULL; |
164 | 174 | ||
175 | if (!filename) { | ||
176 | show_error("No snapshot name specified"); | ||
177 | return; | ||
178 | } | ||
179 | |||
165 | f = get_format(filename); | 180 | f = get_format(filename); |
166 | if (!f) { | 181 | if (!f) { |
167 | ctx.page.mimetype = "text/html"; | 182 | show_error(xstrdup(fmt("Unsupported snapshot format: %s", |
168 | cgit_print_http_headers(&ctx); | 183 | filename))); |
169 | cgit_print_docstart(&ctx); | ||
170 | cgit_print_pageheader(&ctx); | ||
171 | cgit_print_error(fmt("Unsupported snapshot format: %s", filename)); | ||
172 | cgit_print_docend(); | ||
173 | return; | 184 | return; |
174 | } | 185 | } |
175 | 186 | ||
176 | if (!hex && dwim) { | 187 | if (!hex && dwim) { |
177 | hex = get_ref_from_filename(ctx.repo->url, filename, f); | 188 | hex = get_ref_from_filename(ctx.repo->url, filename, f); |
178 | if (hex == NULL) { | 189 | if (hex == NULL) { |
179 | html_status(404, "Not found", 0); | 190 | html_status(404, "Not found", 0); |
180 | return; | 191 | return; |
181 | } | 192 | } |
182 | prefix = xstrdup(filename); | 193 | prefix = xstrdup(filename); |
183 | prefix[strlen(filename) - strlen(f->suffix)] = '\0'; | 194 | prefix[strlen(filename) - strlen(f->suffix)] = '\0'; |
184 | } | 195 | } |
@@ -16,51 +16,59 @@ char *match_path; | |||
16 | int header = 0; | 16 | int header = 0; |
17 | 17 | ||
18 | static void print_text_buffer(char *buf, unsigned long size) | 18 | static void print_text_buffer(char *buf, unsigned long size) |
19 | { | 19 | { |
20 | unsigned long lineno, idx; | 20 | unsigned long lineno, idx; |
21 | const char *numberfmt = | 21 | const char *numberfmt = |
22 | "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n"; | 22 | "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n"; |
23 | 23 | ||
24 | html("<table summary='blob content' class='blob'>\n"); | 24 | html("<table summary='blob content' class='blob'>\n"); |
25 | html("<tr><td class='linenumbers'><pre>"); | 25 | html("<tr><td class='linenumbers'><pre>"); |
26 | idx = 0; | 26 | idx = 0; |
27 | lineno = 0; | 27 | lineno = 0; |
28 | |||
29 | if (size) { | ||
28 | htmlf(numberfmt, ++lineno); | 30 | htmlf(numberfmt, ++lineno); |
29 | while(idx < size - 1) { // skip absolute last newline | 31 | while(idx < size - 1) { // skip absolute last newline |
30 | if (buf[idx] == '\n') | 32 | if (buf[idx] == '\n') |
31 | htmlf(numberfmt, ++lineno); | 33 | htmlf(numberfmt, ++lineno); |
32 | idx++; | 34 | idx++; |
33 | } | 35 | } |
36 | } | ||
34 | html("</pre></td>\n"); | 37 | html("</pre></td>\n"); |
35 | html("<td class='lines'><pre><code>"); | 38 | html("<td class='lines'><pre><code>"); |
36 | html_txt(buf); | 39 | html_txt(buf); |
37 | html("</code></pre></td></tr></table>\n"); | 40 | html("</code></pre></td></tr></table>\n"); |
38 | } | 41 | } |
39 | 42 | ||
43 | #define ROWLEN 32 | ||
44 | |||
40 | static void print_binary_buffer(char *buf, unsigned long size) | 45 | static void print_binary_buffer(char *buf, unsigned long size) |
41 | { | 46 | { |
42 | unsigned long ofs, idx; | 47 | unsigned long ofs, idx; |
48 | static char ascii[ROWLEN + 1]; | ||
43 | 49 | ||
44 | html("<table summary='blob content' class='bin-blob'>\n"); | 50 | html("<table summary='blob content' class='bin-blob'>\n"); |
45 | html("<tr><th>ofs</th><th>hex dump</th><th>ascii</th></tr>"); | 51 | html("<tr><th>ofs</th><th>hex dump</th><th>ascii</th></tr>"); |
46 | for (ofs = 0; ofs < size; ofs += 32, buf += 32) { | 52 | for (ofs = 0; ofs < size; ofs += ROWLEN, buf += ROWLEN) { |
47 | htmlf("<tr><td class='right'>%04x</td><td class='hex'>", ofs); | 53 | htmlf("<tr><td class='right'>%04x</td><td class='hex'>", ofs); |
48 | for (idx = 0; idx < 32 && ofs + idx < size; idx++) | 54 | for (idx = 0; idx < ROWLEN && ofs + idx < size; idx++) |
49 | htmlf("%*s%02x", | 55 | htmlf("%*s%02x", |
50 | idx == 16 ? 4 : 1, "", | 56 | idx == 16 ? 4 : 1, "", |
51 | buf[idx] & 0xff); | 57 | buf[idx] & 0xff); |
52 | html(" </td><td class='hex'>"); | 58 | html(" </td><td class='hex'>"); |
53 | for (idx = 0; idx < 32 && ofs + idx < size; idx++) | 59 | for (idx = 0; idx < ROWLEN && ofs + idx < size; idx++) |
54 | htmlf("%c", isgraph(buf[idx]) ? buf[idx] : '.'); | 60 | ascii[idx] = isgraph(buf[idx]) ? buf[idx] : '.'; |
61 | ascii[idx] = '\0'; | ||
62 | html_txt(ascii); | ||
55 | html("</td></tr>\n"); | 63 | html("</td></tr>\n"); |
56 | } | 64 | } |
57 | html("</table>\n"); | 65 | html("</table>\n"); |
58 | } | 66 | } |
59 | 67 | ||
60 | static void print_object(const unsigned char *sha1, char *path) | 68 | static void print_object(const unsigned char *sha1, char *path) |
61 | { | 69 | { |
62 | enum object_type type; | 70 | enum object_type type; |
63 | char *buf; | 71 | char *buf; |
64 | unsigned long size; | 72 | unsigned long size; |
65 | 73 | ||
66 | type = sha1_object_info(sha1, &size); | 74 | type = sha1_object_info(sha1, &size); |