diff options
-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
diff --git a/Makefile b/Makefile index 914db1c..5e16a4f 100644 --- a/Makefile +++ b/Makefile | |||
@@ -31,14 +31,12 @@ CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' | |||
31 | 31 | ||
32 | 32 | ||
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 | # |
38 | GITVER = $(shell git version 2>/dev/null || echo nogit) | 36 | 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 |
43 | INITGIT = ./submodules.sh -i | 41 | INITGIT = ./submodules.sh -i |
44 | endif | 42 | endif |
diff --git a/cgit.h b/cgit.h index e5b3f5e..e0879bd 100644 --- a/cgit.h +++ b/cgit.h | |||
@@ -87,6 +87,7 @@ extern int cgit_cmd; | |||
87 | extern char *cgit_root_title; | 87 | extern char *cgit_root_title; |
88 | extern char *cgit_css; | 88 | 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; |
91 | extern char *cgit_module_link; | 92 | extern char *cgit_module_link; |
92 | extern char *cgit_virtual_root; | 93 | extern char *cgit_virtual_root; |
@@ -158,6 +159,7 @@ extern void html_hidden(char *name, char *value); | |||
158 | extern void html_link_open(char *url, char *title, char *class); | 159 | extern void html_link_open(char *url, char *title, char *class); |
159 | extern void html_link_close(void); | 160 | 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 | ||
162 | extern int cgit_read_config(const char *filename, configfn fn); | 164 | extern int cgit_read_config(const char *filename, configfn fn); |
163 | extern int cgit_parse_query(char *txt, configfn fn); | 165 | extern int cgit_parse_query(char *txt, configfn fn); |
diff --git a/git b/git | |||
Subproject 9159afbfce955db86373dab95b5f8e31fb763da | Subproject aba170cdb4874b72dd619e6f7bbc13c33295f83 | ||
diff --git a/html.c b/html.c index 175b4b6..33a956f 100644 --- a/html.c +++ b/html.c | |||
@@ -166,3 +166,17 @@ void html_filemode(unsigned short mode) | |||
166 | html_fileperm(mode >> 3); | 166 | html_fileperm(mode >> 3); |
167 | html_fileperm(mode); | 167 | html_fileperm(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 | } | ||
diff --git a/shared.c b/shared.c index 0b074da..45fde7f 100644 --- a/shared.c +++ b/shared.c | |||
@@ -15,6 +15,7 @@ int cgit_cmd; | |||
15 | char *cgit_root_title = "Git repository browser"; | 15 | char *cgit_root_title = "Git repository browser"; |
16 | char *cgit_css = "/cgit.css"; | 16 | 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/"; |
19 | char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; | 20 | char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; |
20 | char *cgit_virtual_root = NULL; | 21 | char *cgit_virtual_root = NULL; |
@@ -127,6 +128,8 @@ void cgit_global_config_cb(const char *name, const char *value) | |||
127 | cgit_css = xstrdup(value); | 128 | cgit_css = xstrdup(value); |
128 | else if (!strcmp(name, "logo")) | 129 | else if (!strcmp(name, "logo")) |
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")) |
131 | cgit_logo_link = xstrdup(value); | 134 | cgit_logo_link = xstrdup(value); |
132 | else if (!strcmp(name, "module-link")) | 135 | else if (!strcmp(name, "module-link")) |
diff --git a/ui-repolist.c b/ui-repolist.c index d7311e4..8e367a2 100644 --- a/ui-repolist.c +++ b/ui-repolist.c | |||
@@ -17,6 +17,11 @@ void cgit_print_repolist(struct cacheitem *item) | |||
17 | cgit_print_pageheader(cgit_root_title, 0); | 17 | cgit_print_pageheader(cgit_root_title, 0); |
18 | 18 | ||
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'>" |
21 | "<th class='left'>Name</th>" | 26 | "<th class='left'>Name</th>" |
22 | "<th class='left'>Description</th>" | 27 | "<th class='left'>Description</th>" |