diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | cgit.c | 17 | ||||
-rw-r--r-- | cgit.css | 15 | ||||
-rw-r--r-- | cgit.h | 8 | ||||
-rw-r--r-- | cgitrc.5.txt | 16 | ||||
-rw-r--r-- | cmd.c | 48 | ||||
-rw-r--r-- | cmd.h | 3 | ||||
-rw-r--r-- | parsing.c | 4 | ||||
-rw-r--r-- | scan-tree.c | 2 | ||||
-rw-r--r-- | shared.c | 15 | ||||
-rw-r--r-- | ui-atom.c | 4 | ||||
-rw-r--r-- | ui-commit.c | 30 | ||||
-rw-r--r-- | ui-commit.h | 2 | ||||
-rw-r--r-- | ui-diff.c | 22 | ||||
-rw-r--r-- | ui-log.c | 40 | ||||
-rw-r--r-- | ui-patch.c | 8 | ||||
-rw-r--r-- | ui-patch.h | 2 | ||||
-rw-r--r-- | ui-plain.c | 68 | ||||
-rw-r--r-- | ui-refs.c | 2 | ||||
-rw-r--r-- | ui-shared.c | 231 | ||||
-rw-r--r-- | ui-shared.h | 72 | ||||
-rw-r--r-- | ui-tree.c | 15 |
22 files changed, 435 insertions, 191 deletions
@@ -1,4 +1,4 @@ | |||
1 | CGIT_VERSION = v0.8.3.1 | 1 | CGIT_VERSION = v0.8.3.2 |
2 | CGIT_SCRIPT_NAME = cgit.cgi | 2 | CGIT_SCRIPT_NAME = cgit.cgi |
3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit | 3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit |
4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) | 4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) |
@@ -62,6 +62,8 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) | |||
62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); | 62 | repo->enable_log_linecount = ctx.cfg.enable_log_linecount * atoi(value); |
63 | else if (!strcmp(name, "enable-remote-branches")) | 63 | else if (!strcmp(name, "enable-remote-branches")) |
64 | repo->enable_remote_branches = atoi(value); | 64 | repo->enable_remote_branches = atoi(value); |
65 | else if (!strcmp(name, "enable-subject-links")) | ||
66 | repo->enable_subject_links = atoi(value); | ||
65 | else if (!strcmp(name, "max-stats")) | 67 | else if (!strcmp(name, "max-stats")) |
66 | repo->max_stats = cgit_find_stats_period(value, NULL); | 68 | repo->max_stats = cgit_find_stats_period(value, NULL); |
67 | else if (!strcmp(name, "module-link")) | 69 | else if (!strcmp(name, "module-link")) |
@@ -141,6 +143,8 @@ void config_cb(const char *name, const char *value) | |||
141 | ctx.cfg.enable_log_linecount = atoi(value); | 143 | ctx.cfg.enable_log_linecount = atoi(value); |
142 | else if (!strcmp(name, "enable-remote-branches")) | 144 | else if (!strcmp(name, "enable-remote-branches")) |
143 | ctx.cfg.enable_remote_branches = atoi(value); | 145 | ctx.cfg.enable_remote_branches = atoi(value); |
146 | else if (!strcmp(name, "enable-subject-links")) | ||
147 | ctx.cfg.enable_subject_links = atoi(value); | ||
144 | else if (!strcmp(name, "enable-tree-linenumbers")) | 148 | else if (!strcmp(name, "enable-tree-linenumbers")) |
145 | ctx.cfg.enable_tree_linenumbers = atoi(value); | 149 | ctx.cfg.enable_tree_linenumbers = atoi(value); |
146 | else if (!strcmp(name, "max-stats")) | 150 | else if (!strcmp(name, "max-stats")) |
@@ -165,6 +169,8 @@ void config_cb(const char *name, const char *value) | |||
165 | ctx.cfg.commit_filter = new_filter(value, 0); | 169 | ctx.cfg.commit_filter = new_filter(value, 0); |
166 | else if (!strcmp(name, "embedded")) | 170 | else if (!strcmp(name, "embedded")) |
167 | ctx.cfg.embedded = atoi(value); | 171 | ctx.cfg.embedded = atoi(value); |
172 | else if (!strcmp(name, "max-atom-items")) | ||
173 | ctx.cfg.max_atom_items = atoi(value); | ||
168 | else if (!strcmp(name, "max-message-length")) | 174 | else if (!strcmp(name, "max-message-length")) |
169 | ctx.cfg.max_msg_len = atoi(value); | 175 | ctx.cfg.max_msg_len = atoi(value); |
170 | else if (!strcmp(name, "max-repodesc-length")) | 176 | else if (!strcmp(name, "max-repodesc-length")) |
@@ -250,6 +256,10 @@ static void querystring_cb(const char *name, const char *value) | |||
250 | ctx.qry.period = xstrdup(value); | 256 | ctx.qry.period = xstrdup(value); |
251 | } else if (!strcmp(name, "ss")) { | 257 | } else if (!strcmp(name, "ss")) { |
252 | ctx.qry.ssdiff = atoi(value); | 258 | ctx.qry.ssdiff = atoi(value); |
259 | } else if (!strcmp(name, "all")) { | ||
260 | ctx.qry.show_all = atoi(value); | ||
261 | } else if (!strcmp(name, "context")) { | ||
262 | ctx.qry.context = atoi(value); | ||
253 | } | 263 | } |
254 | } | 264 | } |
255 | 265 | ||
@@ -292,6 +302,7 @@ static void prepare_context(struct cgit_context *ctx) | |||
292 | ctx->cfg.summary_branches = 10; | 302 | ctx->cfg.summary_branches = 10; |
293 | ctx->cfg.summary_log = 10; | 303 | ctx->cfg.summary_log = 10; |
294 | ctx->cfg.summary_tags = 10; | 304 | ctx->cfg.summary_tags = 10; |
305 | ctx->cfg.max_atom_items = 10; | ||
295 | ctx->cfg.ssdiff = 0; | 306 | ctx->cfg.ssdiff = 0; |
296 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); | 307 | ctx->env.cgit_config = xstrdupn(getenv("CGIT_CONFIG")); |
297 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); | 308 | ctx->env.http_host = xstrdupn(getenv("HTTP_HOST")); |
@@ -424,6 +435,12 @@ static void process_request(void *cbdata) | |||
424 | return; | 435 | return; |
425 | } | 436 | } |
426 | 437 | ||
438 | /* If cmd->want_vpath is set, assume ctx->qry.path contains a "virtual" | ||
439 | * in-project path limit to be made available at ctx->qry.vpath. | ||
440 | * Otherwise, no path limit is in effect (ctx->qry.vpath = NULL). | ||
441 | */ | ||
442 | ctx->qry.vpath = cmd->want_vpath ? ctx->qry.path : NULL; | ||
443 | |||
427 | if (cmd->want_repo && !ctx->repo) { | 444 | if (cmd->want_repo && !ctx->repo) { |
428 | cgit_print_http_headers(ctx); | 445 | cgit_print_http_headers(ctx); |
429 | cgit_print_docstart(ctx); | 446 | cgit_print_docstart(ctx); |
@@ -64,7 +64,7 @@ table#header td.sub { | |||
64 | } | 64 | } |
65 | 65 | ||
66 | table.tabs { | 66 | table.tabs { |
67 | /* border-bottom: solid 2px #ccc; */ | 67 | border-bottom: solid 3px #ccc; |
68 | border-collapse: collapse; | 68 | border-collapse: collapse; |
69 | margin-top: 2em; | 69 | margin-top: 2em; |
70 | margin-bottom: 0px; | 70 | margin-bottom: 0px; |
@@ -102,10 +102,16 @@ table.tabs td.form select { | |||
102 | font-size: 90%; | 102 | font-size: 90%; |
103 | } | 103 | } |
104 | 104 | ||
105 | div.path { | ||
106 | margin: 0px; | ||
107 | padding: 5px 2em 2px 2em; | ||
108 | color: #000; | ||
109 | background-color: #eee; | ||
110 | } | ||
111 | |||
105 | div.content { | 112 | div.content { |
106 | margin: 0px; | 113 | margin: 0px; |
107 | padding: 2em; | 114 | padding: 2em; |
108 | border-top: solid 3px #ccc; | ||
109 | border-bottom: solid 3px #ccc; | 115 | border-bottom: solid 3px #ccc; |
110 | } | 116 | } |
111 | 117 | ||
@@ -525,7 +531,10 @@ a.deco { | |||
525 | border: solid 1px #770000; | 531 | border: solid 1px #770000; |
526 | } | 532 | } |
527 | 533 | ||
528 | div.commit-subject a { | 534 | div.commit-subject a.branch-deco, |
535 | div.commit-subject a.tag-deco, | ||
536 | div.commit-subject a.remote-deco, | ||
537 | div.commit-subject a.deco { | ||
529 | margin-left: 1em; | 538 | margin-left: 1em; |
530 | font-size: 75%; | 539 | font-size: 75%; |
531 | } | 540 | } |
@@ -73,6 +73,7 @@ struct cgit_repo { | |||
73 | int enable_log_filecount; | 73 | int enable_log_filecount; |
74 | int enable_log_linecount; | 74 | int enable_log_linecount; |
75 | int enable_remote_branches; | 75 | int enable_remote_branches; |
76 | int enable_subject_links; | ||
76 | int max_stats; | 77 | int max_stats; |
77 | time_t mtime; | 78 | time_t mtime; |
78 | struct cgit_filter *about_filter; | 79 | struct cgit_filter *about_filter; |
@@ -145,6 +146,9 @@ struct cgit_query { | |||
145 | char *sort; | 146 | char *sort; |
146 | int showmsg; | 147 | int showmsg; |
147 | int ssdiff; | 148 | int ssdiff; |
149 | int show_all; | ||
150 | int context; | ||
151 | char *vpath; | ||
148 | }; | 152 | }; |
149 | 153 | ||
150 | struct cgit_config { | 154 | struct cgit_config { |
@@ -181,8 +185,10 @@ struct cgit_config { | |||
181 | int enable_log_filecount; | 185 | int enable_log_filecount; |
182 | int enable_log_linecount; | 186 | int enable_log_linecount; |
183 | int enable_remote_branches; | 187 | int enable_remote_branches; |
188 | int enable_subject_links; | ||
184 | int enable_tree_linenumbers; | 189 | int enable_tree_linenumbers; |
185 | int local_time; | 190 | int local_time; |
191 | int max_atom_items; | ||
186 | int max_repo_count; | 192 | int max_repo_count; |
187 | int max_commit_count; | 193 | int max_commit_count; |
188 | int max_lock_attempts; | 194 | int max_lock_attempts; |
@@ -273,7 +279,7 @@ extern void *cgit_free_commitinfo(struct commitinfo *info); | |||
273 | extern int cgit_diff_files(const unsigned char *old_sha1, | 279 | extern int cgit_diff_files(const unsigned char *old_sha1, |
274 | const unsigned char *new_sha1, | 280 | const unsigned char *new_sha1, |
275 | unsigned long *old_size, unsigned long *new_size, | 281 | unsigned long *old_size, unsigned long *new_size, |
276 | int *binary, linediff_fn fn); | 282 | int *binary, int context, linediff_fn fn); |
277 | 283 | ||
278 | extern void cgit_diff_tree(const unsigned char *old_sha1, | 284 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
279 | const unsigned char *new_sha1, | 285 | const unsigned char *new_sha1, |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index d74d9e7..a853522 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -115,6 +115,12 @@ enable-remote-branches:: | |||
115 | in the summary and refs views. Default value: "0". See also: | 115 | in the summary and refs views. Default value: "0". See also: |
116 | "repo.enable-remote-branches". | 116 | "repo.enable-remote-branches". |
117 | 117 | ||
118 | enable-subject-links:: | ||
119 | Flag which, when set to "1", will make cgit use the subject of the | ||
120 | parent commit as link text when generating links to parent commits | ||
121 | in commit view. Default value: "0". See also: | ||
122 | "repo.enable-subject-links". | ||
123 | |||
118 | enable-tree-linenumbers:: | 124 | enable-tree-linenumbers:: |
119 | Flag which, when set to "1", will make cgit generate linenumber links | 125 | Flag which, when set to "1", will make cgit generate linenumber links |
120 | for plaintext blobs printed in the tree view. Default value: "1". | 126 | for plaintext blobs printed in the tree view. Default value: "1". |
@@ -166,6 +172,10 @@ logo-link:: | |||
166 | calculated url of the repository index page will be used. Default | 172 | calculated url of the repository index page will be used. Default |
167 | value: none. | 173 | value: none. |
168 | 174 | ||
175 | max-atom-items:: | ||
176 | Specifies the number of items to display in atom feeds view. Default | ||
177 | value: "10". | ||
178 | |||
169 | max-commit-count:: | 179 | max-commit-count:: |
170 | Specifies the number of entries to list per page in "log" view. Default | 180 | Specifies the number of entries to list per page in "log" view. Default |
171 | value: "50". | 181 | value: "50". |
@@ -321,6 +331,10 @@ repo.enable-remote-branches:: | |||
321 | Flag which, when set to "1", will make cgit display remote branches | 331 | Flag which, when set to "1", will make cgit display remote branches |
322 | in the summary and refs views. Default value: <enable-remote-branches>. | 332 | in the summary and refs views. Default value: <enable-remote-branches>. |
323 | 333 | ||
334 | repo.enable-subject-links:: | ||
335 | A flag which can be used to override the global setting | ||
336 | `enable-subject-links'. Default value: none. | ||
337 | |||
324 | repo.max-stats:: | 338 | repo.max-stats:: |
325 | Override the default maximum statistics period. Valid values are equal | 339 | Override the default maximum statistics period. Valid values are equal |
326 | to the values specified for the global "max-stats" setting. Default | 340 | to the values specified for the global "max-stats" setting. Default |
@@ -430,7 +444,7 @@ snapshots=tar.gz tar.bz2 zip | |||
430 | ## List of common mimetypes | 444 | ## List of common mimetypes |
431 | ## | 445 | ## |
432 | 446 | ||
433 | mimetype.git=image/git | 447 | mimetype.gif=image/gif |
434 | mimetype.html=text/html | 448 | mimetype.html=text/html |
435 | mimetype.jpg=image/jpeg | 449 | mimetype.jpg=image/jpeg |
436 | mimetype.jpeg=image/jpeg | 450 | mimetype.jpeg=image/jpeg |
@@ -33,7 +33,7 @@ static void HEAD_fn(struct cgit_context *ctx) | |||
33 | 33 | ||
34 | static void atom_fn(struct cgit_context *ctx) | 34 | static void atom_fn(struct cgit_context *ctx) |
35 | { | 35 | { |
36 | cgit_print_atom(ctx->qry.head, ctx->qry.path, 10); | 36 | cgit_print_atom(ctx->qry.head, ctx->qry.path, ctx->cfg.max_atom_items); |
37 | } | 37 | } |
38 | 38 | ||
39 | static void about_fn(struct cgit_context *ctx) | 39 | static void about_fn(struct cgit_context *ctx) |
@@ -51,7 +51,7 @@ static void blob_fn(struct cgit_context *ctx) | |||
51 | 51 | ||
52 | static void commit_fn(struct cgit_context *ctx) | 52 | static void commit_fn(struct cgit_context *ctx) |
53 | { | 53 | { |
54 | cgit_print_commit(ctx->qry.sha1); | 54 | cgit_print_commit(ctx->qry.sha1, ctx->qry.path); |
55 | } | 55 | } |
56 | 56 | ||
57 | static void diff_fn(struct cgit_context *ctx) | 57 | static void diff_fn(struct cgit_context *ctx) |
@@ -90,7 +90,7 @@ static void repolist_fn(struct cgit_context *ctx) | |||
90 | 90 | ||
91 | static void patch_fn(struct cgit_context *ctx) | 91 | static void patch_fn(struct cgit_context *ctx) |
92 | { | 92 | { |
93 | cgit_print_patch(ctx->qry.sha1); | 93 | cgit_print_patch(ctx->qry.sha1, ctx->qry.path); |
94 | } | 94 | } |
95 | 95 | ||
96 | static void plain_fn(struct cgit_context *ctx) | 96 | static void plain_fn(struct cgit_context *ctx) |
@@ -129,31 +129,31 @@ static void tree_fn(struct cgit_context *ctx) | |||
129 | cgit_print_tree(ctx->qry.sha1, ctx->qry.path); | 129 | cgit_print_tree(ctx->qry.sha1, ctx->qry.path); |
130 | } | 130 | } |
131 | 131 | ||
132 | #define def_cmd(name, want_repo, want_layout) \ | 132 | #define def_cmd(name, want_repo, want_layout, want_vpath) \ |
133 | {#name, name##_fn, want_repo, want_layout} | 133 | {#name, name##_fn, want_repo, want_layout, want_vpath} |
134 | 134 | ||
135 | struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) | 135 | struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) |
136 | { | 136 | { |
137 | static struct cgit_cmd cmds[] = { | 137 | static struct cgit_cmd cmds[] = { |
138 | def_cmd(HEAD, 1, 0), | 138 | def_cmd(HEAD, 1, 0, 0), |
139 | def_cmd(atom, 1, 0), | 139 | def_cmd(atom, 1, 0, 0), |
140 | def_cmd(about, 0, 1), | 140 | def_cmd(about, 0, 1, 0), |
141 | def_cmd(blob, 1, 0), | 141 | def_cmd(blob, 1, 0, 0), |
142 | def_cmd(commit, 1, 1), | 142 | def_cmd(commit, 1, 1, 1), |
143 | def_cmd(diff, 1, 1), | 143 | def_cmd(diff, 1, 1, 1), |
144 | def_cmd(info, 1, 0), | 144 | def_cmd(info, 1, 0, 0), |
145 | def_cmd(log, 1, 1), | 145 | def_cmd(log, 1, 1, 1), |
146 | def_cmd(ls_cache, 0, 0), | 146 | def_cmd(ls_cache, 0, 0, 0), |
147 | def_cmd(objects, 1, 0), | 147 | def_cmd(objects, 1, 0, 0), |
148 | def_cmd(patch, 1, 0), | 148 | def_cmd(patch, 1, 0, 1), |
149 | def_cmd(plain, 1, 0), | 149 | def_cmd(plain, 1, 0, 0), |
150 | def_cmd(refs, 1, 1), | 150 | def_cmd(refs, 1, 1, 0), |
151 | def_cmd(repolist, 0, 0), | 151 | def_cmd(repolist, 0, 0, 0), |
152 | def_cmd(snapshot, 1, 0), | 152 | def_cmd(snapshot, 1, 0, 0), |
153 | def_cmd(stats, 1, 1), | 153 | def_cmd(stats, 1, 1, 1), |
154 | def_cmd(summary, 1, 1), | 154 | def_cmd(summary, 1, 1, 0), |
155 | def_cmd(tag, 1, 1), | 155 | def_cmd(tag, 1, 1, 0), |
156 | def_cmd(tree, 1, 1), | 156 | def_cmd(tree, 1, 1, 1), |
157 | }; | 157 | }; |
158 | int i; | 158 | int i; |
159 | 159 | ||
@@ -7,7 +7,8 @@ struct cgit_cmd { | |||
7 | const char *name; | 7 | const char *name; |
8 | cgit_cmd_fn fn; | 8 | cgit_cmd_fn fn; |
9 | unsigned int want_repo:1, | 9 | unsigned int want_repo:1, |
10 | want_layout:1; | 10 | want_layout:1, |
11 | want_vpath:1; | ||
11 | }; | 12 | }; |
12 | 13 | ||
13 | extern struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx); | 14 | extern struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx); |
@@ -190,6 +190,10 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) | |||
190 | ret->subject = xstrdup(p); | 190 | ret->subject = xstrdup(p); |
191 | 191 | ||
192 | if (ret->msg_encoding) { | 192 | if (ret->msg_encoding) { |
193 | reencode(&ret->author, PAGE_ENCODING, ret->msg_encoding); | ||
194 | reencode(&ret->author_email, PAGE_ENCODING, ret->msg_encoding); | ||
195 | reencode(&ret->committer, PAGE_ENCODING, ret->msg_encoding); | ||
196 | reencode(&ret->committer_email, PAGE_ENCODING, ret->msg_encoding); | ||
193 | reencode(&ret->subject, PAGE_ENCODING, ret->msg_encoding); | 197 | reencode(&ret->subject, PAGE_ENCODING, ret->msg_encoding); |
194 | reencode(&ret->msg, PAGE_ENCODING, ret->msg_encoding); | 198 | reencode(&ret->msg, PAGE_ENCODING, ret->msg_encoding); |
195 | } | 199 | } |
diff --git a/scan-tree.c b/scan-tree.c index dbca797..1e18f3c 100644 --- a/scan-tree.c +++ b/scan-tree.c | |||
@@ -56,6 +56,8 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) | |||
56 | path, strerror(errno), errno); | 56 | path, strerror(errno), errno); |
57 | return; | 57 | return; |
58 | } | 58 | } |
59 | if (!stat(fmt("%s/noweb", path), &st)) | ||
60 | return; | ||
59 | if ((pwd = getpwuid(st.st_uid)) == NULL) { | 61 | if ((pwd = getpwuid(st.st_uid)) == NULL) { |
60 | fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n", | 62 | fprintf(stderr, "Error reading owner-info for %s: %s (%d)\n", |
61 | path, strerror(errno), errno); | 63 | path, strerror(errno), errno); |
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | struct cgit_repolist cgit_repolist; | 11 | struct cgit_repolist cgit_repolist; |
12 | struct cgit_context ctx; | 12 | struct cgit_context ctx; |
13 | int cgit_cmd; | ||
14 | 13 | ||
15 | int chk_zero(int result, char *msg) |