summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h1
-rw-r--r--cgitrc.5.txt4
-rw-r--r--ui-tree.c27
4 files changed, 23 insertions, 11 deletions
diff --git a/cgit.c b/cgit.c
index b0e1c44..a4788cb 100644
--- a/cgit.c
+++ b/cgit.c
@@ -57,24 +57,26 @@ void config_cb(const char *name, const char *value)
57 else if (!strcmp(name, "head-include")) 57 else if (!strcmp(name, "head-include"))
58 ctx.cfg.head_include = xstrdup(value); 58 ctx.cfg.head_include = xstrdup(value);
59 else if (!strcmp(name, "header")) 59 else if (!strcmp(name, "header"))
60 ctx.cfg.header = xstrdup(value); 60 ctx.cfg.header = xstrdup(value);
61 else if (!strcmp(name, "logo")) 61 else if (!strcmp(name, "logo"))
62 ctx.cfg.logo = xstrdup(value); 62 ctx.cfg.logo = xstrdup(value);
63 else if (!strcmp(name, "index-header")) 63 else if (!strcmp(name, "index-header"))
64 ctx.cfg.index_header = xstrdup(value); 64 ctx.cfg.index_header = xstrdup(value);
65 else if (!strcmp(name, "index-info")) 65 else if (!strcmp(name, "index-info"))
66 ctx.cfg.index_info = xstrdup(value); 66 ctx.cfg.index_info = xstrdup(value);
67 else if (!strcmp(name, "logo-link")) 67 else if (!strcmp(name, "logo-link"))
68 ctx.cfg.logo_link = xstrdup(value); 68 ctx.cfg.logo_link = xstrdup(value);
69 else if (!strcmp(name, "linenumbers"))
70 ctx.cfg.linenumbers = atoi(value);
69 else if (!strcmp(name, "module-link")) 71 else if (!strcmp(name, "module-link"))
70 ctx.cfg.module_link = xstrdup(value); 72 ctx.cfg.module_link = xstrdup(value);
71 else if (!strcmp(name, "virtual-root")) { 73 else if (!strcmp(name, "virtual-root")) {
72 ctx.cfg.virtual_root = trim_end(value, '/'); 74 ctx.cfg.virtual_root = trim_end(value, '/');
73 if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) 75 if (!ctx.cfg.virtual_root && (!strcmp(value, "/")))
74 ctx.cfg.virtual_root = ""; 76 ctx.cfg.virtual_root = "";
75 } else if (!strcmp(name, "nocache")) 77 } else if (!strcmp(name, "nocache"))
76 ctx.cfg.nocache = atoi(value); 78 ctx.cfg.nocache = atoi(value);
77 else if (!strcmp(name, "noplainemail")) 79 else if (!strcmp(name, "noplainemail"))
78 ctx.cfg.noplainemail = atoi(value); 80 ctx.cfg.noplainemail = atoi(value);
79 else if (!strcmp(name, "noheader")) 81 else if (!strcmp(name, "noheader"))
80 ctx.cfg.noheader = atoi(value); 82 ctx.cfg.noheader = atoi(value);
diff --git a/cgit.h b/cgit.h
index adb8da4..2fdc531 100644
--- a/cgit.h
+++ b/cgit.h
@@ -165,24 +165,25 @@ struct cgit_config {
165 char *virtual_root; 165 char *virtual_root;
166 int cache_size; 166 int cache_size;
167 int cache_dynamic_ttl; 167 int cache_dynamic_ttl;
168 int cache_max_create_time; 168 int cache_max_create_time;
169 int cache_repo_ttl; 169 int cache_repo_ttl;
170 int cache_root_ttl; 170 int cache_root_ttl;
171 int cache_static_ttl; 171 int cache_static_ttl;
172 int embedded; 172 int embedded;
173 int enable_index_links; 173 int enable_index_links;
174 int enable_log_filecount; 174 int enable_log_filecount;
175 int enable_log_linecount; 175 int enable_log_linecount;
176 int local_time; 176 int local_time;
177 int linenumbers;
177 int max_repo_count; 178 int max_repo_count;
178 int max_commit_count; 179 int max_commit_count;
179 int max_lock_attempts; 180 int max_lock_attempts;
180 int max_msg_len; 181 int max_msg_len;
181 int max_repodesc_len; 182 int max_repodesc_len;
182 int max_stats; 183 int max_stats;
183 int nocache; 184 int nocache;
184 int noplainemail; 185 int noplainemail;
185 int noheader; 186 int noheader;
186 int renamelimit; 187 int renamelimit;
187 int snapshots; 188 int snapshots;
188 int summary_branches; 189 int summary_branches;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 3c35b02..a762ccc 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -137,24 +137,28 @@ local-time::
137 Flag which, if set to "1", makes cgit print commit and tag times in the 137 Flag which, if set to "1", makes cgit print commit and tag times in the
138 servers timezone. Default value: "0". 138 servers timezone. Default value: "0".
139 139
140logo:: 140logo::
141 Url which specifies the source of an image which will be used as a logo 141 Url which specifies the source of an image which will be used as a logo
142 on all cgit pages. Default value: "/cgit.png". 142 on all cgit pages. Default value: "/cgit.png".
143 143
144logo-link:: 144logo-link::
145 Url loaded when clicking on the cgit logo image. If unspecified the 145 Url loaded when clicking on the cgit logo image. If unspecified the
146 calculated url of the repository index page will be used. Default 146 calculated url of the repository index page will be used. Default
147 value: none. 147 value: none.
148 148
149linenumbers::
150 If set to "1" lines in tree view will have numbers.
151 Default value: "0".
152
149max-commit-count:: 153max-commit-count::
150 Specifies the number of entries to list per page in "log" view. Default 154 Specifies the number of entries to list per page in "log" view. Default
151 value: "50". 155 value: "50".
152 156
153max-message-length:: 157max-message-length::
154 Specifies the maximum number of commit message characters to display in 158 Specifies the maximum number of commit message characters to display in
155 "log" view. Default value: "80". 159 "log" view. Default value: "80".
156 160
157max-repo-count:: 161max-repo-count::
158 Specifies the number of entries to list per page on therepository 162 Specifies the number of entries to list per page on therepository
159 index page. Default value: "50". 163 index page. Default value: "50".
160 164
diff --git a/ui-tree.c b/ui-tree.c
index 7bf2ad2..f64e6e0 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -14,37 +14,42 @@
14char *curr_rev; 14char *curr_rev;
15char *match_path; 15char *match_path;
16int header = 0; 16int header = 0;
17 17
18static void print_text_buffer(const char *name, char *buf, unsigned long size) 18static void print_text_buffer(const char *name, 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 25
26 html("<tr><td class='linenumbers'><pre>"); 26 if (ctx.cfg.linenumbers) {
27 idx = 0; 27 html("<tr><td class='linenumbers'><pre>");
28 lineno = 0; 28 idx = 0;
29 29 lineno = 0;
30 if (size) { 30
31 htmlf(numberfmt, ++lineno); 31 if (size) {
32 while(idx < size - 1) { // skip absolute last newline 32 htmlf(numberfmt, ++lineno);
33 if (buf[idx] == '\n') 33 while(idx < size - 1) { // skip absolute last newline
34 htmlf(numberfmt, ++lineno); 34 if (buf[idx] == '\n')
35 idx++; 35 htmlf(numberfmt, ++lineno);
36 idx++;
37 }
36 } 38 }
39 html("</pre></td>\n");
40 }
41 else {
42 html("<tr>\n");
37 } 43 }
38 html("</pre></td>\n");
39 44
40 if (ctx.repo->source_filter) { 45 if (ctx.repo->source_filter) {
41 html("<td class='lines'><pre><code>"); 46 html("<td class='lines'><pre><code>");
42 ctx.repo->source_filter->argv[1] = xstrdup(name); 47 ctx.repo->source_filter->argv[1] = xstrdup(name);
43 cgit_open_filter(ctx.repo->source_filter); 48 cgit_open_filter(ctx.repo->source_filter);
44 write(STDOUT_FILENO, buf, size); 49 write(STDOUT_FILENO, buf, size);
45 cgit_close_filter(ctx.repo->source_filter); 50 cgit_close_filter(ctx.repo->source_filter);
46 html("</code></pre></td></tr></table>\n"); 51 html("</code></pre></td></tr></table>\n");
47 return; 52 return;
48 } 53 }
49 54
50 html("<td class='lines'><pre><code>"); 55 html("<td class='lines'><pre><code>");