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-atom.c2
-rw-r--r--ui-commit.c12
-rw-r--r--ui-patch.c6
-rw-r--r--ui-tag.c2
-rw-r--r--ui-tree.c8
8 files changed, 29 insertions, 8 deletions
diff --git a/cgit.c b/cgit.c
index 4f414c3..aa1107a 100644
--- a/cgit.c
+++ b/cgit.c
@@ -50,24 +50,26 @@ void config_cb(const char *name, const char *value)
50 else if (!strcmp(name, "index-info")) 50 else if (!strcmp(name, "index-info"))
51 ctx.cfg.index_info = xstrdup(value); 51 ctx.cfg.index_info = xstrdup(value);
52 else if (!strcmp(name, "logo-link")) 52 else if (!strcmp(name, "logo-link"))
53 ctx.cfg.logo_link = xstrdup(value); 53 ctx.cfg.logo_link = xstrdup(value);
54 else if (!strcmp(name, "module-link")) 54 else if (!strcmp(name, "module-link"))
55 ctx.cfg.module_link = xstrdup(value); 55 ctx.cfg.module_link = xstrdup(value);
56 else if (!strcmp(name, "virtual-root")) { 56 else if (!strcmp(name, "virtual-root")) {
57 ctx.cfg.virtual_root = trim_end(value, '/'); 57 ctx.cfg.virtual_root = trim_end(value, '/');
58 if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) 58 if (!ctx.cfg.virtual_root && (!strcmp(value, "/")))
59 ctx.cfg.virtual_root = ""; 59 ctx.cfg.virtual_root = "";
60 } else if (!strcmp(name, "nocache")) 60 } else if (!strcmp(name, "nocache"))
61 ctx.cfg.nocache = atoi(value); 61 ctx.cfg.nocache = atoi(value);
62 else if (!strcmp(name, "noplainemail"))
63 ctx.cfg.noplainemail = atoi(value);
62 else if (!strcmp(name, "noheader")) 64 else if (!strcmp(name, "noheader"))
63 ctx.cfg.noheader = atoi(value); 65 ctx.cfg.noheader = atoi(value);
64 else if (!strcmp(name, "snapshots")) 66 else if (!strcmp(name, "snapshots"))
65 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); 67 ctx.cfg.snapshots = cgit_parse_snapshots_mask(value);
66 else if (!strcmp(name, "enable-index-links")) 68 else if (!strcmp(name, "enable-index-links"))
67 ctx.cfg.enable_index_links = atoi(value); 69 ctx.cfg.enable_index_links = atoi(value);
68 else if (!strcmp(name, "enable-log-filecount")) 70 else if (!strcmp(name, "enable-log-filecount"))
69 ctx.cfg.enable_log_filecount = atoi(value); 71 ctx.cfg.enable_log_filecount = atoi(value);
70 else if (!strcmp(name, "enable-log-linecount")) 72 else if (!strcmp(name, "enable-log-linecount"))
71 ctx.cfg.enable_log_linecount = atoi(value); 73 ctx.cfg.enable_log_linecount = atoi(value);
72 else if (!strcmp(name, "max-stats")) 74 else if (!strcmp(name, "max-stats"))
73 ctx.cfg.max_stats = cgit_find_stats_period(value, NULL); 75 ctx.cfg.max_stats = cgit_find_stats_period(value, NULL);
diff --git a/cgit.h b/cgit.h
index 9259f33..1194eb0 100644
--- a/cgit.h
+++ b/cgit.h
@@ -160,24 +160,25 @@ struct cgit_config {
160 int embedded; 160 int embedded;
161 int enable_index_links; 161 int enable_index_links;
162 int enable_log_filecount; 162 int enable_log_filecount;
163 int enable_log_linecount; 163 int enable_log_linecount;
164 int local_time; 164 int local_time;
165 int max_repo_count; 165 int max_repo_count;
166 int max_commit_count; 166 int max_commit_count;
167 int max_lock_attempts; 167 int max_lock_attempts;
168 int max_msg_len; 168 int max_msg_len;
169 int max_repodesc_len; 169 int max_repodesc_len;
170 int max_stats; 170 int max_stats;
171 int nocache; 171 int nocache;
172 int noplainemail;
172 int noheader; 173 int noheader;
173 int renamelimit; 174 int renamelimit;
174 int snapshots; 175 int snapshots;
175 int summary_branches; 176 int summary_branches;
176 int summary_log; 177 int summary_log;
177 int summary_tags; 178 int summary_tags;
178 struct string_list mimetypes; 179 struct string_list mimetypes;
179}; 180};
180 181
181struct cgit_page { 182struct cgit_page {
182 time_t modified; 183 time_t modified;
183 time_t expires; 184 time_t expires;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 7256ec0..0412f64 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -153,24 +153,28 @@ mimetype.<ext>::
153 153
154module-link:: 154module-link::
155 Text which will be used as the formatstring for a hyperlink when a 155 Text which will be used as the formatstring for a hyperlink when a
156 submodule is printed in a directory listing. The arguments for the 156 submodule is printed in a directory listing. The arguments for the
157 formatstring are the path and SHA1 of the submodule commit. Default 157 formatstring are the path and SHA1 of the submodule commit. Default
158 value: "./?repo=%s&page=commit&id=%s" 158 value: "./?repo=%s&page=commit&id=%s"
159 159
160nocache:: 160nocache::
161 If set to the value "1" caching will be disabled. This settings is 161 If set to the value "1" caching will be disabled. This settings is
162 deprecated, and will not be honored starting with cgit-1.0. Default 162 deprecated, and will not be honored starting with cgit-1.0. Default
163 value: "0". 163 value: "0".
164 164
165noplainemail::
166 If set to "1" showing full author email adresses will be disabled.
167 Default value: "0".
168
165noheader:: 169noheader::
166 Flag which, when set to "1", will make cgit omit the standard header 170 Flag which, when set to "1", will make cgit omit the standard header
167 on all pages. Default value: none. See also: "embedded". 171 on all pages. Default value: none. See also: "embedded".
168 172
169renamelimit:: 173renamelimit::
170 Maximum number of files to consider when detecting renames. The value 174 Maximum number of files to consider when detecting renames. The value
171 "-1" uses the compiletime value in git (for further info, look at 175 "-1" uses the compiletime value in git (for further info, look at
172 `man git-diff`). Default value: "-1". 176 `man git-diff`). Default value: "-1".
173 177
174repo.group:: 178repo.group::
175 A value for the current repository group, which all repositories 179 A value for the current repository group, which all repositories
176 specified after this setting will inherit. Default value: none. 180 specified after this setting will inherit. Default value: none.
diff --git a/ui-atom.c b/ui-atom.c
index e5c31d9..808b2d0 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -23,25 +23,25 @@ void add_entry(struct commit *commit, char *host)
23 html("<title>"); 23 html("<title>");
24 html_txt(info->subject); 24 html_txt(info->subject);
25 html("</title>\n"); 25 html("</title>\n");
26 html("<updated>"); 26 html("<updated>");
27 cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); 27 cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time);
28 html("</updated>\n"); 28 html("</updated>\n");
29 html("<author>\n"); 29 html("<author>\n");
30 if (info->author) { 30 if (info->author) {
31 html("<name>"); 31 html("<name>");
32 html_txt(info->author); 32 html_txt(info->author);
33 html("</name>\n"); 33 html("</name>\n");
34 } 34 }
35 if (info->author_email) { 35 if (info->author_email && !ctx.cfg.noplainemail) {
36 mail = xstrdup(info->author_email); 36 mail = xstrdup(info->author_email);
37 t = strchr(mail, '<'); 37 t = strchr(mail, '<');
38 if (t) 38 if (t)
39 t++; 39 t++;
40 else 40 else
41 t = mail; 41 t = mail;
42 t2 = strchr(t, '>'); 42 t2 = strchr(t, '>');
43 if (t2) 43 if (t2)
44 *t2 = '\0'; 44 *t2 = '\0';
45 html("<email>"); 45 html("<email>");
46 html_txt(t); 46 html_txt(t);
47 html("</email>\n"); 47 html("</email>\n");
diff --git a/ui-commit.c b/ui-commit.c
index 41ce70e..9fdb8ee 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -31,33 +31,37 @@ void cgit_print_commit(char *hex)
31 commit = lookup_commit_reference(sha1); 31 commit = lookup_commit_reference(sha1);
32 if (!commit) { 32 if (!commit) {
33 cgit_print_error(fmt("Bad commit reference: %s", hex)); 33 cgit_print_error(fmt("Bad commit reference: %s", hex));
34 return; 34 return;
35 } 35 }
36 info = cgit_parse_commit(commit); 36 info = cgit_parse_commit(commit);
37 37
38 load_ref_decorations(); 38 load_ref_decorations();
39 39
40 html("<table summary='commit info' class='commit-info'>\n"); 40 html("<table summary='commit info' class='commit-info'>\n");
41 html("<tr><th>author</th><td>"); 41 html("<tr><th>author</th><td>");
42 html_txt(info->author); 42 html_txt(info->author);
43 html(" "); 43 if (!ctx.cfg.noplainemail) {
44 html_txt(info->author_email); 44 html(" ");
45 html_txt(info->author_email);
46 }
45 html("</td><td class='right'>"); 47 html("</td><td class='right'>");
46 cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time); 48 cgit_print_date(info->author_date, FMT_LONGDATE, ctx.cfg.local_time);
47 html("</td></tr>\n"); 49 html("</td></tr>\n");
48 html("<tr><th>committer</th><td>"); 50 html("<tr><th>committer</th><td>");
49 html_txt(info->committer); 51 html_txt(info->committer);
50 html(" "); 52 if (!ctx.cfg.noplainemail) {
51 html_txt(info->committer_email); 53 html(" ");
54 html_txt(info->committer_email);
55 }
52 html("</td><td class='right'>"); 56 html("</td><td class='right'>");
53 cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time); 57 cgit_print_date(info->committer_date, FMT_LONGDATE, ctx.cfg.local_time);
54 html("</td></tr>\n"); 58 html("</td></tr>\n");
55 html("<tr><th>commit</th><td colspan='2' class='sha1'>"); 59 html("<tr><th>commit</th><td colspan='2' class='sha1'>");
56 tmp = sha1_to_hex(commit->object.sha1); 60 tmp = sha1_to_hex(commit->object.sha1);
57 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); 61 cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp);
58 html(" ("); 62 html(" (");
59 cgit_patch_link("patch", NULL, NULL, NULL, tmp); 63 cgit_patch_link("patch", NULL, NULL, NULL, tmp);
60 html(")</td></tr>\n"); 64 html(")</td></tr>\n");
61 html("<tr><th>tree</th><td colspan='2' class='sha1'>"); 65 html("<tr><th>tree</th><td colspan='2' class='sha1'>");
62 tmp = xstrdup(hex); 66 tmp = xstrdup(hex);
63 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, 67 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL,
diff --git a/ui-patch.c b/ui-patch.c
index 5d665d3..2a8f7a5 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -99,25 +99,29 @@ void cgit_print_patch(char *hex)
99 info = cgit_parse_commit(commit); 99 info = cgit_parse_commit(commit);
100 100
101 if (commit->parents && commit->parents->item) 101 if (commit->parents && commit->parents->item)
102 hashcpy(old_sha1, commit->parents->item->object.sha1); 102 hashcpy(old_sha1, commit->parents->item->object.sha1);
103 else 103 else
104 hashclr(old_sha1); 104 hashclr(old_sha1);
105 105
106 patchname = fmt("%s.patch", sha1_to_hex(sha1)); 106 patchname = fmt("%s.patch", sha1_to_hex(sha1));
107 ctx.page.mimetype = "text/plain"; 107 ctx.page.mimetype = "text/plain";
108 ctx.page.filename = patchname; 108 ctx.page.filename = patchname;
109 cgit_print_http_headers(&ctx); 109 cgit_print_http_headers(&ctx);
110 htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1)); 110 htmlf("From %s Mon Sep 17 00:00:00 2001\n", sha1_to_hex(sha1));
111 htmlf("From: %s %s\n", info->author, info->author_email); 111 htmlf("From: %s", info->author);
112 if (!ctx.cfg.noplainemail) {
113 htmlf(" %s", info->author_email);
114 }
115 html("\n");
112 html("Date: "); 116 html("Date: ");
113 cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time); 117 cgit_print_date(info->author_date, "%a, %d %b %Y %H:%M:%S %z%n", ctx.cfg.local_time);
114 htmlf("Subject: %s\n\n", info->subject); 118 htmlf("Subject: %s\n\n", info->subject);
115 if (info->msg && *info->msg) { 119 if (info->msg && *info->msg) {
116 htmlf("%s", info->msg); 120 htmlf("%s", info->msg);
117 if (info->msg[strlen(info->msg) - 1] != '\n') 121 if (info->msg[strlen(info->msg) - 1] != '\n')
118 html("\n"); 122 html("\n");
119 } 123 }
120 html("---\n"); 124 html("---\n");
121 cgit_diff_tree(old_sha1, sha1, filepair_cb, NULL); 125 cgit_diff_tree(old_sha1, sha1, filepair_cb, NULL);
122 html("--\n"); 126 html("--\n");
123 htmlf("cgit %s\n", CGIT_VERSION); 127 htmlf("cgit %s\n", CGIT_VERSION);
diff --git a/ui-tag.c b/ui-tag.c
index 0e056e0..a9c8670 100644
--- a/ui-tag.c
+++ b/ui-tag.c
@@ -55,25 +55,25 @@ void cgit_print_tag(char *revname)
55 html("<table class='commit-info'>\n"); 55 html("<table class='commit-info'>\n");
56 htmlf("<tr><td>Tag name</td><td>"); 56 htmlf("<tr><td>Tag name</td><td>");
57 html_txt(revname); 57 html_txt(revname);
58 htmlf(" (%s)</td></tr>\n", sha1_to_hex(sha1)); 58 htmlf(" (%s)</td></tr>\n", sha1_to_hex(sha1));
59 if (info->tagger_date > 0) { 59 if (info->tagger_date > 0) {
60 html("<tr><td>Tag date</td><td>"); 60 html("<tr><td>Tag date</td><td>");
61 cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time); 61 cgit_print_date(info->tagger_date, FMT_LONGDATE, ctx.cfg.local_time);
62 html("</td></tr>\n"); 62 html("</td></tr>\n");
63 } 63 }
64 if (info->tagger) { 64 if (info->tagger) {
65 html("<tr><td>Tagged by</td><td>"); 65 html("<tr><td>Tagged by</td><td>");
66 html_txt(info->tagger); 66 html_txt(info->tagger);
67 if (info->tagger_email) { 67 if (info->tagger_email && !ctx.cfg.noplainemail) {
68 html(" "); 68 html(" ");
69 html_txt(info->tagger_email); 69 html_txt(info->tagger_email);
70 } 70 }
71 html("</td></tr>\n"); 71 html("</td></tr>\n");
72 } 72 }
73 html("<tr><td>Tagged object</td><td>"); 73 html("<tr><td>Tagged object</td><td>");
74 cgit_object_link(tag->tagged); 74 cgit_object_link(tag->tagged);
75 html("</td></tr>\n"); 75 html("</td></tr>\n");
76 html("</table>\n"); 76 html("</table>\n");
77 print_tag_content(info->msg); 77 print_tag_content(info->msg);
78 } else { 78 } else {
79 html("<table class='commit-info'>\n"); 79 html("<table class='commit-info'>\n");
diff --git a/ui-tree.c b/ui-tree.c
index 553dbaa..61fcf5a 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -94,24 +94,25 @@ static void print_object(const unsigned char *sha1, char *path)
94 print_binary_buffer(buf, size); 94 print_binary_buffer(buf, size);
95 else 95 else
96 print_text_buffer(buf, size); 96 print_text_buffer(buf, size);
97} 97}
98 98
99 99
100static int ls_item(const unsigned char *sha1, const char *base, int baselen, 100static int ls_item(const unsigned char *sha1, const char *base, int baselen,
101 const char *pathname, unsigned int mode, int stage, 101 const char *pathname, unsigned int mode, int stage,
102 void *cbdata) 102 void *cbdata)
103{ 103{
104 char *name; 104 char *name;
105 char *fullpath; 105 char *fullpath;
106 char *class;
106 enum object_type type; 107 enum object_type type;
107 unsigned long size = 0; 108 unsigned long size = 0;
108 109
109 name = xstrdup(pathname); 110 name = xstrdup(pathname);
110 fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", 111 fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "",
111 ctx.qry.path ? "/" : "", name); 112 ctx.qry.path ? "/" : "", name);
112 113
113 if (!S_ISGITLINK(mode)) { 114 if (!S_ISGITLINK(mode)) {
114 type = sha1_object_info(sha1, &size); 115 type = sha1_object_info(sha1, &size);
115 if (type == OBJ_BAD) { 116 if (type == OBJ_BAD) {
116 htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", 117 htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>",
117 name, 118 name,
@@ -126,25 +127,30 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
126 if (S_ISGITLINK(mode)) { 127 if (S_ISGITLINK(mode)) {
127 htmlf("<a class='ls-mod' href='"); 128 htmlf("<a class='ls-mod' href='");
128 html_attr(fmt(ctx.repo->module_link, 129 html_attr(fmt(ctx.repo->module_link,
129 name, 130 name,
130 sha1_to_hex(sha1))); 131 sha1_to_hex(sha1)));
131 html("'>"); 132 html("'>");
132 html_txt(name); 133 html_txt(name);
133 html("</a>"); 134 html("</a>");
134 } else if (S_ISDIR(mode)) { 135 } else if (S_ISDIR(mode)) {
135 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, 136 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head,
136 curr_rev, fullpath); 137 curr_rev, fullpath);
137 } else { 138 } else {
138 cgit_tree_link(name, NULL, "ls-blob", ctx.qry.head, 139 class = strrchr(name, '.');
140 if (class != NULL) {
141 class = fmt("ls-blob %s", class + 1);
142 } else
143 class = "ls-blob";
144 cgit_tree_link(name, NULL, class, ctx.qry.head,
139 curr_rev, fullpath); 145 curr_rev, fullpath);
140 } 146 }
141 htmlf("</td><td class='ls-size'>%li</td>", size); 147 htmlf("</td><td class='ls-size'>%li</td>", size);
142 148
143 html("<td>"); 149 html("<td>");
144 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, 150 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,
145 fullpath, 0, NULL, NULL, ctx.qry.showmsg); 151 fullpath, 0, NULL, NULL, ctx.qry.showmsg);
146 if (ctx.repo->max_stats) 152 if (ctx.repo->max_stats)
147 cgit_stats_link("stats", NULL, "button", ctx.qry.head, 153 cgit_stats_link("stats", NULL, "button", ctx.qry.head,
148 fullpath); 154 fullpath);
149 html("</td></tr>\n"); 155 html("</td></tr>\n");
150 free(name); 156 free(name);