summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2007-05-23 20:46:54 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-05-23 20:46:54 (UTC)
commitbbcdc290c6c0b8121e57dbca4bd66c9e5e729959 (patch) (unidiff)
treefb762f2153b60cc4f997095626af70baa16ce7b1
parent25da3f76255754c8b3f98232a5eb84f47088d0f7 (diff)
downloadcgit-bbcdc290c6c0b8121e57dbca4bd66c9e5e729959.zip
cgit-bbcdc290c6c0b8121e57dbca4bd66c9e5e729959.tar.gz
cgit-bbcdc290c6c0b8121e57dbca4bd66c9e5e729959.tar.bz2
Add repo.readme parameter
This parameter can be used to specify a repo-specific includefile, which will then be printed on the summary page for the repo. If the parametervalue is a not an absolute path, it is taken to be relative to repo.path. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.css14
-rw-r--r--cgit.h1
-rw-r--r--cgitrc1
-rw-r--r--shared.c8
-rw-r--r--ui-summary.c14
5 files changed, 23 insertions, 15 deletions
diff --git a/cgit.css b/cgit.css
index 327eaba..8977533 100644
--- a/cgit.css
+++ b/cgit.css
@@ -137,28 +137,26 @@ td#search input {
137 width: 10em; 137 width: 10em;
138 border: solid 1px #333; 138 border: solid 1px #333;
139 color: #333; 139 color: #333;
140 background-color: #fff; 140 background-color: #fff;
141} 141}
142 142
143td#summary { 143div#summary {
144 vertical-align: top; 144 vertical-align: top;
145 padding-bottom: 1em; 145 margin-bottom: 1em;
146} 146}
147 147
148td#archivelist { 148table#downloads {
149 padding-bottom: 1em;
150}
151
152td#archivelist table {
153 float: right; 149 float: right;
154 border-collapse: collapse; 150 border-collapse: collapse;
155 border: solid 1px #777; 151 border: solid 1px #777;
152 margin-left: 0.5em;
153 margin-bottom: 0.5em;
156} 154}
157 155
158td#archivelist table th { 156table#downloads th {
159 background-color: #ccc; 157 background-color: #ccc;
160} 158}
161 159
162td#content { 160td#content {
163 padding: 1em 0.5em; 161 padding: 1em 0.5em;
164} 162}
diff --git a/cgit.h b/cgit.h
index 3938633..5c55bec 100644
--- a/cgit.h
+++ b/cgit.h
@@ -65,12 +65,13 @@ struct repoinfo {
65 char *path; 65 char *path;
66 char *desc; 66 char *desc;
67 char *owner; 67 char *owner;
68 char *defbranch; 68 char *defbranch;
69 char *group; 69 char *group;
70 char *module_link; 70 char *module_link;
71 char *readme;
71 int snapshots; 72 int snapshots;
72 int enable_log_filecount; 73 int enable_log_filecount;
73 int enable_log_linecount; 74 int enable_log_linecount;
74}; 75};
75 76
76struct repolist { 77struct repolist {
diff --git a/cgitrc b/cgitrc
index eaa9ce3..054a708 100644
--- a/cgitrc
+++ b/cgitrc
@@ -105,6 +105,7 @@
105#repo.path=/pub/git/cgit 105#repo.path=/pub/git/cgit
106#repo.owner=Lars Hjemli 106#repo.owner=Lars Hjemli
107 #repo.snapshots=1 # override a sitewide snapshot-setting 107 #repo.snapshots=1 # override a sitewide snapshot-setting
108 #repo.enable-log-filecount=0 # override the default filecount setting 108 #repo.enable-log-filecount=0 # override the default filecount setting
109 #repo.enable-log-linecount=0 # override the default linecount setting 109 #repo.enable-log-linecount=0 # override the default linecount setting
110 #repo.module-link=/git/%s/commit/?id=%s # override the standard module-link 110 #repo.module-link=/git/%s/commit/?id=%s # override the standard module-link
111 #repo.readme=info/web/readme # specify a file to include on summary page
diff --git a/shared.c b/shared.c
index ce3ca4f..e3123a8 100644
--- a/shared.c
+++ b/shared.c
@@ -104,12 +104,13 @@ struct repoinfo *add_repo(const char *url)
104 ret->group = cgit_repo_group; 104 ret->group = cgit_repo_group;
105 ret->defbranch = "master"; 105 ret->defbranch = "master";
106 ret->snapshots = cgit_snapshots; 106 ret->snapshots = cgit_snapshots;
107 ret->enable_log_filecount = cgit_enable_log_filecount; 107 ret->enable_log_filecount = cgit_enable_log_filecount;
108 ret->enable_log_linecount = cgit_enable_log_linecount; 108 ret->enable_log_linecount = cgit_enable_log_linecount;
109 ret->module_link = cgit_module_link; 109 ret->module_link = cgit_module_link;
110 ret->readme = NULL;
110 return ret; 111 return ret;
111} 112}
112 113
113struct repoinfo *cgit_get_repoinfo(const char *url) 114struct repoinfo *cgit_get_repoinfo(const char *url)
114{ 115{
115 int i; 116 int i;
@@ -184,13 +185,18 @@ void cgit_global_config_cb(const char *name, const char *value)
184 else if (cgit_repo && !strcmp(name, "repo.enable-log-filecount")) 185 else if (cgit_repo && !strcmp(name, "repo.enable-log-filecount"))
185 cgit_repo->enable_log_filecount = cgit_enable_log_filecount * atoi(value); 186 cgit_repo->enable_log_filecount = cgit_enable_log_filecount * atoi(value);
186 else if (cgit_repo && !strcmp(name, "repo.enable-log-linecount")) 187 else if (cgit_repo && !strcmp(name, "repo.enable-log-linecount"))
187 cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value); 188 cgit_repo->enable_log_linecount = cgit_enable_log_linecount * atoi(value);
188 else if (cgit_repo && !strcmp(name, "repo.module-link")) 189 else if (cgit_repo && !strcmp(name, "repo.module-link"))
189 cgit_repo->module_link= xstrdup(value); 190 cgit_repo->module_link= xstrdup(value);
190 else if (!strcmp(name, "include")) 191 else if (cgit_repo && !strcmp(name, "repo.readme") && value != NULL) {
192 if (*value == '/')
193 cgit_repo->readme = xstrdup(value);
194 else
195 cgit_repo->readme = xstrdup(fmt("%s/%s", cgit_repo->path, value));
196 } else if (!strcmp(name, "include"))
191 cgit_read_config(value, cgit_global_config_cb); 197 cgit_read_config(value, cgit_global_config_cb);
192} 198}
193 199
194void cgit_querystring_cb(const char *name, const char *value) 200void cgit_querystring_cb(const char *name, const char *value)
195{ 201{
196 if (!strcmp(name,"r")) { 202 if (!strcmp(name,"r")) {
diff --git a/ui-summary.c b/ui-summary.c
index 5799773..5c1fc33 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -150,13 +150,13 @@ static int cgit_print_archive_cb(const char *refname, const unsigned char *sha1,
150 } else if (obj->type != OBJ_BLOB) { 150 } else if (obj->type != OBJ_BLOB) {
151 return 0; 151 return 0;
152 } else { 152 } else {
153 hashcpy(fileid, sha1); 153 hashcpy(fileid, sha1);
154 } 154 }
155 if (!header) { 155 if (!header) {
156 html("<table>"); 156 html("<table id='downloads'>");
157 html("<tr><th>Downloads</th></tr>"); 157 html("<tr><th>Downloads</th></tr>");
158 header = 1; 158 header = 1;
159 } 159 }
160 html("<tr><td>"); 160 html("<tr><td>");
161 url = cgit_pageurl(cgit_query_repo, "blob", 161 url = cgit_pageurl(cgit_query_repo, "blob",
162 fmt("id=%s&path=%s", sha1_to_hex(fileid), 162 fmt("id=%s&path=%s", sha1_to_hex(fileid),
@@ -190,21 +190,23 @@ static void cgit_print_archives()
190 if (header) 190 if (header)
191 html("</table>"); 191 html("</table>");
192} 192}
193 193
194void cgit_print_summary() 194void cgit_print_summary()
195{ 195{
196 html("<table class='list nowrap'>"); 196 html("<div id='summary'>");
197 html("<tr class='nohover'><td id='summary' colspan='3'>"); 197 cgit_print_archives();
198 html("<h2>"); 198 html("<h2>");
199 html_txt(cgit_repo->name); 199 html_txt(cgit_repo->name);
200 html(" - "); 200 html(" - ");
201 html_txt(cgit_repo->desc); 201 html_txt(cgit_repo->desc);
202 html("</h2>"); 202 html("</h2>");
203 html("</td><td id='archivelist'>"); 203 if (cgit_repo->readme)
204 cgit_print_archives(); 204 html_include(cgit_repo->readme);
205 html("</td></tr>"); 205 html("</div>");
206
207 html("<table class='list nowrap'>");
206 cgit_print_branches(); 208 cgit_print_branches();
207 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>"); 209 html("<tr class='nohover'><td colspan='4'>&nbsp;</td></tr>");
208 cgit_print_tags(); 210 cgit_print_tags();
209 html("</table>"); 211 html("</table>");
210} 212}