about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--cgit.h2
m---------git0
-rw-r--r--html.c14
-rw-r--r--shared.c3
-rw-r--r--ui-repolist.c5
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#
38GITVER = $(shell git version 2>/dev/null || echo nogit) 36GITVER = $(shell git version 2>/dev/null || echo nogit)
39ifeq ($(GITVER),nogit) 37ifeq ($(GITVER),nogit)
40GITURL = http://hjemli.net/git/git/snapshot/?id=v1.5.2-rc2 38GITURL = http://www.kernel.org/pub/software/scm/git/git-1.5.2.tar.bz2
41INITGIT = test -e git/git.c || (curl "$(GITURL)" > tmp.zip && unzip tmp.zip) 39INITGIT = test -e git/git.c || ((curl "$(GITURL)" | tar -xj) && mv git-1.5.2 git)
42else 40else
43INITGIT = ./submodules.sh -i 41INITGIT = ./submodules.sh -i
44endif 42endif
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;
87extern char *cgit_root_title; 87extern char *cgit_root_title;
88extern char *cgit_css; 88extern char *cgit_css;
89extern char *cgit_logo; 89extern char *cgit_logo;
90extern char *cgit_index_header;
90extern char *cgit_logo_link; 91extern char *cgit_logo_link;
91extern char *cgit_module_link; 92extern char *cgit_module_link;
92extern char *cgit_virtual_root; 93extern char *cgit_virtual_root;
@@ -158,6 +159,7 @@ extern void html_hidden(char *name, char *value);
158extern void html_link_open(char *url, char *title, char *class); 159extern void html_link_open(char *url, char *title, char *class);
159extern void html_link_close(void); 160extern void html_link_close(void);
160extern void html_filemode(unsigned short mode); 161extern void html_filemode(unsigned short mode);
162extern int html_include(const char *filename);
161 163
162extern int cgit_read_config(const char *filename, configfn fn); 164extern int cgit_read_config(const char *filename, configfn fn);
163extern int cgit_parse_query(char *txt, configfn fn); 165extern 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
170int 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;
15char *cgit_root_title = "Git repository browser"; 15char *cgit_root_title = "Git repository browser";
16char *cgit_css = "/cgit.css"; 16char *cgit_css = "/cgit.css";
17char *cgit_logo = "/git-logo.png"; 17char *cgit_logo = "/git-logo.png";
18char *cgit_index_header = NULL;
18char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; 19char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/";
19char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; 20char *cgit_module_link = "./?repo=%s&page=commit&id=%s";
20char *cgit_virtual_root = NULL; 21char *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>"