-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | cgit.h | 2 | ||||
m--------- | git | 0 | ||||
-rw-r--r-- | html.c | 14 | ||||
-rw-r--r-- | shared.c | 3 | ||||
-rw-r--r-- | ui-repolist.c | 5 |
6 files changed, 27 insertions, 5 deletions
@@ -33,5 +33,3 @@ CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' | |||
33 | # | 33 | # |
34 | # If make is run on a nongit platform, we need to get the git sources as a tarball. | 34 | # If make is run on a nongit platform, get the git sources as a tarball. |
35 | # But there is currently no recent enough tarball available on kernel.org, so download | ||
36 | # a zipfile from hjemli.net instead | ||
37 | # | 35 | # |
@@ -39,4 +37,4 @@ GITVER = $(shell git version 2>/dev/null || echo nogit) | |||
39 | ifeq ($(GITVER),nogit) | 37 | ifeq ($(GITVER),nogit) |
40 | GITURL = http://hjemli.net/git/git/snapshot/?id=v1.5.2-rc2 | 38 | GITURL = http://www.kernel.org/pub/software/scm/git/git-1.5.2.tar.bz2 |
41 | INITGIT = test -e git/git.c || (curl "$(GITURL)" > tmp.zip && unzip tmp.zip) | 39 | INITGIT = test -e git/git.c || ((curl "$(GITURL)" | tar -xj) && mv git-1.5.2 git) |
42 | else | 40 | else |
@@ -89,2 +89,3 @@ extern char *cgit_css; | |||
89 | extern char *cgit_logo; | 89 | extern char *cgit_logo; |
90 | extern char *cgit_index_header; | ||
90 | extern char *cgit_logo_link; | 91 | extern char *cgit_logo_link; |
@@ -160,2 +161,3 @@ extern void html_link_close(void); | |||
160 | extern void html_filemode(unsigned short mode); | 161 | extern void html_filemode(unsigned short mode); |
162 | extern int html_include(const char *filename); | ||
161 | 163 | ||
diff --git a/git b/git | |||
Subproject 9159afbfce955db86373dab95b5f8e31fb763da | Subproject aba170cdb4874b72dd619e6f7bbc13c33295f83 | ||
@@ -168 +168,15 @@ void html_filemode(unsigned short mode) | |||
168 | } | 168 | } |
169 | |||
170 | int html_include(const char *filename) | ||
171 | { | ||
172 | FILE *f; | ||
173 | char buf[4096]; | ||
174 | size_t len; | ||
175 | |||
176 | if (!(f = fopen(filename, "r"))) | ||
177 | return -1; | ||
178 | while((len = fread(buf, 1, 4096, f)) > 0) | ||
179 | write(htmlfd, buf, len); | ||
180 | fclose(f); | ||
181 | return 0; | ||
182 | } | ||
@@ -17,2 +17,3 @@ char *cgit_css = "/cgit.css"; | |||
17 | char *cgit_logo = "/git-logo.png"; | 17 | char *cgit_logo = "/git-logo.png"; |
18 | char *cgit_index_header = NULL; | ||
18 | char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; | 19 | char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; |
@@ -129,2 +130,4 @@ void cgit_global_config_cb(const char *name, const char *value) | |||
129 | cgit_logo = xstrdup(value); | 130 | cgit_logo = xstrdup(value); |
131 | else if (!strcmp(name, "index-header")) | ||
132 | cgit_index_header = xstrdup(value); | ||
130 | else if (!strcmp(name, "logo-link")) | 133 | else if (!strcmp(name, "logo-link")) |
diff --git a/ui-repolist.c b/ui-repolist.c index d7311e4..8e367a2 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -19,2 +19,7 @@ void cgit_print_repolist(struct cacheitem *item) | |||
19 | html("<table class='list nowrap'>"); | 19 | html("<table class='list nowrap'>"); |
20 | if (cgit_index_header) { | ||
21 | html("<tr class='nohover'><td colspan='4' class='include-block'>"); | ||
22 | html_include(cgit_index_header); | ||
23 | html("</td></tr>"); | ||
24 | } | ||
20 | html("<tr class='nohover'>" | 25 | html("<tr class='nohover'>" |