-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 4 | ||||
-rw-r--r-- | cgitrc.5.txt | 7 | ||||
-rw-r--r-- | scan-tree.c | 4 | ||||
-rw-r--r-- | shared.c | 4 | ||||
-rw-r--r-- | ui-atom.c | 12 | ||||
-rw-r--r-- | ui-log.c | 4 |
9 files changed, 35 insertions, 10 deletions
@@ -1,13 +1,13 @@ | |||
1 | CGIT_VERSION = v0.8.3.3 | 1 | CGIT_VERSION = v0.8.3.4 |
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) |
5 | CGIT_CONFIG = /etc/cgitrc | 5 | CGIT_CONFIG = /etc/cgitrc |
6 | CACHE_ROOT = /var/cache/cgit | 6 | CACHE_ROOT = /var/cache/cgit |
7 | prefix = /usr | 7 | prefix = /usr |
8 | libdir = $(prefix)/lib | 8 | libdir = $(prefix)/lib |
9 | filterdir = $(libdir)/cgit/filters | 9 | filterdir = $(libdir)/cgit/filters |
10 | docdir = $(prefix)/share/doc/cgit | 10 | docdir = $(prefix)/share/doc/cgit |
11 | htmldir = $(docdir) | 11 | htmldir = $(docdir) |
12 | pdfdir = $(docdir) | 12 | pdfdir = $(docdir) |
13 | mandir = $(prefix)/share/man | 13 | mandir = $(prefix)/share/man |
@@ -70,25 +70,25 @@ endif | |||
70 | ifndef V | 70 | ifndef V |
71 | QUIET_CC = @echo ' ' CC $@; | 71 | QUIET_CC = @echo ' ' CC $@; |
72 | QUIET_MM = @echo ' ' MM $@; | 72 | QUIET_MM = @echo ' ' MM $@; |
73 | QUIET_SUBDIR0 = +@subdir= | 73 | QUIET_SUBDIR0 = +@subdir= |
74 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ | 74 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ |
75 | $(MAKE) $(PRINT_DIR) -C $$subdir | 75 | $(MAKE) $(PRINT_DIR) -C $$subdir |
76 | endif | 76 | endif |
77 | 77 | ||
78 | # | 78 | # |
79 | # Define a pattern rule for automatic dependency building | 79 | # Define a pattern rule for automatic dependency building |
80 | # | 80 | # |
81 | %.d: %.c | 81 | %.d: %.c |
82 | $(QUIET_MM)$(CC) $(CFLAGS) -MM $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@ | 82 | $(QUIET_MM)$(CC) $(CFLAGS) -MM -MP $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@ |
83 | 83 | ||
84 | # | 84 | # |
85 | # Define a pattern rule for silent object building | 85 | # Define a pattern rule for silent object building |
86 | # | 86 | # |
87 | %.o: %.c | 87 | %.o: %.c |
88 | $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< | 88 | $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< |
89 | 89 | ||
90 | 90 | ||
91 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread | 91 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lpthread |
92 | OBJECTS = | 92 | OBJECTS = |
93 | OBJECTS += cache.o | 93 | OBJECTS += cache.o |
94 | OBJECTS += cgit.o | 94 | OBJECTS += cgit.o |
@@ -130,24 +130,26 @@ all: cgit | |||
130 | VERSION: force-version | 130 | VERSION: force-version |
131 | @./gen-version.sh "$(CGIT_VERSION)" | 131 | @./gen-version.sh "$(CGIT_VERSION)" |
132 | -include VERSION | 132 | -include VERSION |
133 | 133 | ||
134 | 134 | ||
135 | CFLAGS += -g -Wall -Igit | 135 | CFLAGS += -g -Wall -Igit |
136 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' | 136 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' |
137 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' | 137 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' |
138 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' | 138 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' |
139 | CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' | 139 | CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' |
140 | CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' | 140 | CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' |
141 | 141 | ||
142 | GIT_OPTIONS = prefix=/usr | ||
143 | |||
142 | ifdef NO_ICONV | 144 | ifdef NO_ICONV |
143 | CFLAGS += -DNO_ICONV | 145 | CFLAGS += -DNO_ICONV |
144 | endif | 146 | endif |
145 | ifdef NO_STRCASESTR | 147 | ifdef NO_STRCASESTR |
146 | CFLAGS += -DNO_STRCASESTR | 148 | CFLAGS += -DNO_STRCASESTR |
147 | endif | 149 | endif |
148 | ifdef NO_C99_FORMAT | 150 | ifdef NO_C99_FORMAT |
149 | CFLAGS += -DNO_C99_FORMAT | 151 | CFLAGS += -DNO_C99_FORMAT |
150 | endif | 152 | endif |
151 | ifdef NO_OPENSSL | 153 | ifdef NO_OPENSSL |
152 | CFLAGS += -DNO_OPENSSL | 154 | CFLAGS += -DNO_OPENSSL |
153 | GIT_OPTIONS += NO_OPENSSL=1 | 155 | GIT_OPTIONS += NO_OPENSSL=1 |
@@ -40,25 +40,25 @@ Dependencies: | |||
40 | -zip lib | 40 | -zip lib |
41 | -crypto lib | 41 | -crypto lib |
42 | -openssl lib | 42 | -openssl lib |
43 | 43 | ||
44 | 44 | ||
45 | Apache configuration | 45 | Apache configuration |
46 | 46 | ||
47 | A new Directory-section must probably be added for cgit, possibly something | 47 | A new Directory-section must probably be added for cgit, possibly something |
48 | like this: | 48 | like this: |
49 | 49 | ||
50 | <Directory "/var/www/htdocs/cgit/"> | 50 | <Directory "/var/www/htdocs/cgit/"> |
51 | AllowOverride None | 51 | AllowOverride None |
52 | Options ExecCGI | 52 | Options +ExecCGI |
53 | Order allow,deny | 53 | Order allow,deny |
54 | Allow from all | 54 | Allow from all |
55 | </Directory> | 55 | </Directory> |
56 | 56 | ||
57 | 57 | ||
58 | Runtime configuration | 58 | Runtime configuration |
59 | 59 | ||
60 | The file /etc/cgitrc is read by cgit before handling a request. In addition | 60 | The file /etc/cgitrc is read by cgit before handling a request. In addition |
61 | to runtime parameters, this file also contains a list of the repositories | 61 | to runtime parameters, this file also contains a list of the repositories |
62 | displayed by cgit. | 62 | displayed by cgit. |
63 | 63 | ||
64 | A template cgitrc is shipped with the sources, and all parameters and default | 64 | A template cgitrc is shipped with the sources, and all parameters and default |
@@ -112,24 +112,26 @@ void config_cb(const char *name, const char *value) | |||
112 | else if (!strcmp(name, "header")) | 112 | else if (!strcmp(name, "header")) |
113 | ctx.cfg.header = xstrdup(value); | 113 | ctx.cfg.header = xstrdup(value); |
114 | else if (!strcmp(name, "logo")) | 114 | else if (!strcmp(name, "logo")) |
115 | ctx.cfg.logo = xstrdup(value); | 115 | ctx.cfg.logo = xstrdup(value); |
116 | else if (!strcmp(name, "index-header")) | 116 | else if (!strcmp(name, "index-header")) |
117 | ctx.cfg.index_header = xstrdup(value); | 117 | ctx.cfg.index_header = xstrdup(value); |
118 | else if (!strcmp(name, "index-info")) | 118 | else if (!strcmp(name, "index-info")) |
119 | ctx.cfg.index_info = xstrdup(value); | 119 | ctx.cfg.index_info = xstrdup(value); |
120 | else if (!strcmp(name, "logo-link")) | 120 | else if (!strcmp(name, "logo-link")) |
121 | ctx.cfg.logo_link = xstrdup(value); | 121 | ctx.cfg.logo_link = xstrdup(value); |
122 | else if (!strcmp(name, "module-link")) | 122 | else if (!strcmp(name, "module-link")) |
123 | ctx.cfg.module_link = xstrdup(value); | 123 | ctx.cfg.module_link = xstrdup(value); |
124 | else if (!strcmp(name, "strict-export")) | ||
125 | ctx.cfg.strict_export = xstrdup(value); | ||
124 | else if (!strcmp(name, "virtual-root")) { | 126 | else if (!strcmp(name, "virtual-root")) { |
125 | ctx.cfg.virtual_root = trim_end(value, '/'); | 127 | ctx.cfg.virtual_root = trim_end(value, '/'); |
126 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) | 128 | if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) |
127 | ctx.cfg.virtual_root = ""; | 129 | ctx.cfg.virtual_root = ""; |
128 | } else if (!strcmp(name, "nocache")) | 130 | } else if (!strcmp(name, "nocache")) |
129 | ctx.cfg.nocache = atoi(value); | 131 | ctx.cfg.nocache = atoi(value); |
130 | else if (!strcmp(name, "noplainemail")) | 132 | else if (!strcmp(name, "noplainemail")) |
131 | ctx.cfg.noplainemail = atoi(value); | 133 | ctx.cfg.noplainemail = atoi(value); |
132 | else if (!strcmp(name, "noheader")) | 134 | else if (!strcmp(name, "noheader")) |
133 | ctx.cfg.noheader = atoi(value); | 135 | ctx.cfg.noheader = atoi(value); |
134 | else if (!strcmp(name, "snapshots")) | 136 | else if (!strcmp(name, "snapshots")) |
135 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); | 137 | ctx.cfg.snapshots = cgit_parse_snapshots_mask(value); |
@@ -167,24 +167,25 @@ struct cgit_config { | |||
167 | char *logo; | 167 | char *logo; |
168 | char *logo_link; | 168 | char *logo_link; |
169 | char *module_link; | 169 | char *module_link; |
170 | char *project_list; | 170 | char *project_list; |
171 | char *readme; | 171 | char *readme; |
172 | char *robots; | 172 | char *robots; |
173 | char *root_title; | 173 | char *root_title; |
174 | char *root_desc; | 174 | char *root_desc; |
175 | char *root_readme; | 175 | char *root_readme; |
176 | char *script_name; | 176 | char *script_name; |
177 | char *section; | 177 | char *section; |
178 | char *virtual_root; | 178 | char *virtual_root; |
179 | char *strict_export; | ||
179 | int cache_size; | 180 | int cache_size; |
180 | int cache_dynamic_ttl; | 181 | int cache_dynamic_ttl; |
181 | int cache_max_create_time; | 182 | int cache_max_create_time; |
182 | int cache_repo_ttl; | 183 | int cache_repo_ttl; |
183 | int cache_root_ttl; | 184 | int cache_root_ttl; |
184 | int cache_scanrc_ttl; | 185 | int cache_scanrc_ttl; |
185 | int cache_static_ttl; | 186 | int cache_static_ttl; |
186 | int embedded; | 187 | int embedded; |
187 | int enable_filter_overrides; | 188 | int enable_filter_overrides; |
188 | int enable_gitweb_owner; | 189 | int enable_gitweb_owner; |
189 | int enable_index_links; | 190 | int enable_index_links; |
190 | int enable_log_filecount; | 191 | int enable_log_filecount; |
@@ -284,25 +285,26 @@ extern int cgit_refs_cb(const char *refname, const unsigned char *sha1, | |||
284 | extern void *cgit_free_commitinfo(struct commitinfo *info); | 285 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
285 | 286 | ||
286 | extern int cgit_diff_files(const unsigned char *old_sha1, | 287 | extern int cgit_diff_files(const unsigned char *old_sha1, |
287 | const unsigned char *new_sha1, | 288 | const unsigned char *new_sha1, |
288 | unsigned long *old_size, unsigned long *new_size, | 289 | unsigned long *old_size, unsigned long *new_size, |
289 | int *binary, int context, int ignorews, | 290 | int *binary, int context, int ignorews, |
290 | linediff_fn fn); | 291 | linediff_fn fn); |
291 | 292 | ||
292 | extern void cgit_diff_tree(const unsigned char *old_sha1, | 293 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
293 | const unsigned char *new_sha1, | 294 | const unsigned char *new_sha1, |
294 | filepair_fn fn, const char *prefix, int ignorews); | 295 | filepair_fn fn, const char *prefix, int ignorews); |
295 | 296 | ||
296 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); | 297 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn, |
298 | const char *prefix); | ||
297 | 299 | ||
298 | __attribute__((format (printf,1,2))) | 300 | __attribute__((format (printf,1,2))) |
299 | extern char *fmt(const char *format,...); | 301 | extern char *fmt(const char *format,...); |
300 | 302 | ||
301 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); | 303 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
302 | extern struct taginfo *cgit_parse_tag(struct tag *tag); | 304 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
303 | extern void cgit_parse_url(const char *url); | 305 | extern void cgit_parse_url(const char *url); |
304 | 306 | ||
305 | extern const char *cgit_repobasename(const char *reponame); | 307 | extern const char *cgit_repobasename(const char *reponame); |
306 | 308 | ||
307 | extern int cgit_parse_snapshots_mask(const char *str); | 309 | extern int cgit_parse_snapshots_mask(const char *str); |
308 | 310 | ||
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index ea1b18a..8e51ca5 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -308,24 +308,31 @@ source-filter:: | |||
308 | summary-branches:: | 308 | summary-branches:: |
309 | Specifies the number of branches to display in the repository "summary" | 309 | Specifies the number of branches to display in the repository "summary" |
310 | view. Default value: "10". | 310 | view. Default value: "10". |
311 | 311 | ||
312 | summary-log:: | 312 | summary-log:: |
313 | Specifies the number of log entries to display in the repository | 313 | Specifies the number of log entries to display in the repository |
314 | "summary" view. Default value: "10". | 314 | "summary" view. Default value: "10". |
315 | 315 | ||
316 | summary-tags:: | 316 | summary-tags:: |
317 | Specifies the number of tags to display in the repository "summary" | 317 | Specifies the number of tags to display in the repository "summary" |
318 | view. Default value: "10". | 318 | view. Default value: "10". |
319 | 319 | ||
320 | strict-export:: | ||
321 | Filename which, if specified, needs to be present within the repository | ||
322 | for cgit to allow access to that repository. This can be used to emulate | ||
323 | gitweb's EXPORT_OK and STRICT_EXPORT functionality and limit cgit's | ||
324 | repositories to match those exported by git-daemon. This option MUST come | ||
325 | before 'scan-path'. | ||
326 | |||
320 | virtual-root:: | 327 | virtual-root:: |
321 | Url which, if specified, will be used as root for all cgit links. It | 328 | Url which, if specified, will be used as root for all cgit links. It |
322 | will also cause cgit to generate 'virtual urls', i.e. urls like | 329 | will also cause cgit to generate 'virtual urls', i.e. urls like |
323 | '/cgit/tree/README' as opposed to '?r=cgit&p=tree&path=README'. Default | 330 | '/cgit/tree/README' as opposed to '?r=cgit&p=tree&path=README'. Default |
324 | value: none. | 331 | value: none. |
325 | NOTE: cgit has recently learned how to use PATH_INFO to achieve the | 332 | NOTE: cgit has recently learned how to use PATH_INFO to achieve the |
326 | same kind of virtual urls, so this option will probably be deprecated. | 333 | same kind of virtual urls, so this option will probably be deprecated. |
327 | 334 | ||
328 | REPOSITORY SETTINGS | 335 | REPOSITORY SETTINGS |
329 | ------------------- | 336 | ------------------- |
330 | repo.about-filter:: | 337 | repo.about-filter:: |
331 | Override the default about-filter. Default value: none. See also: | 338 | Override the default about-filter. Default value: none. See also: |
diff --git a/scan-tree.c b/scan-tree.c index b5b50f3..a0e09ce 100644 --- a/scan-tree.c +++ b/scan-tree.c | |||
@@ -72,24 +72,28 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) | |||
72 | { | 72 | { |
73 | struct stat st; | 73 | struct stat st; |
74 | struct passwd *pwd; | 74 | struct passwd *pwd; |
75 | char *rel, *p, *slash; | 75 | char *rel, *p, *slash; |
76 | int n; | 76 | int n; |
77 | size_t size; | 77 | size_t size; |
78 | 78 | ||
79 | if (stat(path, &st)) { | 79 | if (stat(path, &st)) { |
80 | fprintf(stderr, "Error accessing %s: %s (%d)\n", | 80 | fprintf(stderr, "Error accessing %s: %s (%d)\n", |
81 | path, strerror(errno), errno); | 81 | path, strerror(errno), errno); |
82 | return; | 82 | return; |
83 | } | 83 | } |
84 | |||
85 | if (ctx.cfg.strict_export && stat(fmt("%s/%s", path, ctx.cfg.strict_export), &st)) | ||
86 | return; | ||
87 | |||
84 | if (!stat(fmt("%s/noweb", path), &st)) | 88 | if (!stat(fmt("%s/noweb", path), &st)) |
85 | return; | 89 | return; |
86 | 90 | ||
87 | owner = NULL; | 91 | owner = NULL; |
88 | if (ctx.cfg.enable_gitweb_owner) | 92 | if (ctx.cfg.enable_gitweb_owner) |
89 | git_config_from_file(git_owner_config, fmt("%s/config", path), NULL); | 93 | git_config_from_file(git_owner_config, fmt("%s/config", path), NULL); |
90 | if (base == path) | 94 | if (base == path) |
91 | rel = xstrdup(fmt("%s", path)); | 95 | rel = xstrdup(fmt("%s", path)); |
92 | else | 96 | else |
93 | rel = xstrdup(fmt("%s", path + strlen(base) + 1)); | 97 | rel = xstrdup(fmt("%s", path + strlen(base) + 1)); |
94 | 98 | ||
95 | if (!strcmp(rel + strlen(rel) - 5, "/.git")) | 99 | if (!strcmp(rel + strlen(rel) - 5, "/.git")) |
@@ -329,31 +329,31 @@ void cgit_diff_tree(const unsigned char *old_sha1, | |||
329 | opt.pathlens = &prefixlen; | 329 | opt.pathlens = &prefixlen; |
330 | } | 330 | } |
331 | diff_setup_done(&opt); | 331 | diff_setup_done(&opt); |
332 | 332 | ||
333 | if (old_sha1 && !is_null_sha1(old_sha1)) | 333 | if (old_sha1 && !is_null_sha1(old_sha1)) |
334 | ret = diff_tree_sha1(old_sha1, new_sha1, "", &opt); | 334 | ret = diff_tree_sha1(old_sha1, new_sha1, "", &opt); |
335 | else | 335 | else |
336 | ret = diff_root_tree_sha1(new_sha1, "", &opt); | 336 | ret = diff_root_tree_sha1(new_sha1, "", &opt); |
337 | diffcore_std(&opt); | 337 | diffcore_std(&opt); |
338 | diff_flush(&opt); | 338 | diff_flush(&opt); |
339 | } | 339 | } |
340 | 340 | ||
341 | void cgit_diff_commit(struct commit *commit, filepair_fn fn) | 341 | void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix) |
342 | { | 342 | { |
343 | unsigned char *old_sha1 = NULL; | 343 | unsigned char *old_sha1 = NULL; |
344 | 344 | ||
345 | if (commit->parents) | 345 | if (commit->parents) |
346 | old_sha1 = commit->parents->item->object.sha1; | 346 | old_sha1 = commit->parents->item->object.sha1; |
347 | cgit_diff_tree(old_sha1, commit->object.sha1, fn, NULL, | 347 | cgit_diff_tree(old_sha1, commit->object.sha1, fn, prefix, |
348 | ctx.qry.ignorews); | 348 | ctx.qry.ignorews); |
349 | } | 349 | } |
350 | 350 | ||
351 | int cgit_parse_snapshots_mask(const char *str) | 351 | int cgit_parse_snapshots_mask(const char *str) |
352 | { | 352 | { |
353 | const struct cgit_snapshot_format *f; | 353 | const struct cgit_snapshot_format *f; |
354 | static const char *delim = " \t,:/|;"; | 354 | static const char *delim = " \t,:/|;"; |
355 | int tl, sl, rv = 0; | 355 | int tl, sl, rv = 0; |
356 | 356 | ||
357 | /* favor legacy setting */ | 357 | /* favor legacy setting */ |
358 | if(atoi(str)) | 358 | if(atoi(str)) |
359 | return 1; | 359 | return 1; |
@@ -15,50 +15,50 @@ void add_entry(struct commit *commit, char *host) | |||
15 | char delim = '&'; | 15 | char delim = '&'; |
16 | char *hex; | 16 | char *hex; |
17 | char *mail, *t, *t2; | 17 | char *mail, *t, *t2; |
18 | struct commitinfo *info; | 18 | struct commitinfo *info; |
19 | 19 | ||
20 | info = cgit_parse_commit(commit); | 20 | info = cgit_parse_commit(commit); |
21 | hex = sha1_to_hex(commit->object.sha1); | 21 | hex = sha1_to_hex(commit->object.sha1); |
22 | html("<entry>\n"); | 22 | html("<entry>\n"); |
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->committer_date, FMT_ATOMDATE, 0); |
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 && !ctx.cfg.noplainemail) { | 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"); |
48 | free(mail); | 48 | free(mail); |
49 | } | 49 | } |
50 | html("</author>\n"); | 50 | html("</author>\n"); |
51 | html("<published>"); | 51 | html("<published>"); |
52 | cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); | 52 | cgit_print_date(info->author_date, FMT_ATOMDATE, 0); |
53 | html("</published>\n"); | 53 | html("</published>\n"); |
54 | if (host) { | 54 | if (host) { |
55 | html("<link rel='alternate' type='text/html' href='"); | 55 | html("<link rel='alternate' type='text/html' href='"); |
56 | html(cgit_httpscheme()); | 56 | html(cgit_httpscheme()); |
57 | html_attr(host); | 57 | html_attr(host); |
58 | html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL)); | 58 | html_attr(cgit_pageurl(ctx.repo->url, "commit", NULL)); |
59 | if (ctx.cfg.virtual_root) | 59 | if (ctx.cfg.virtual_root) |
60 | delim = '?'; | 60 | delim = '?'; |
61 | htmlf("%cid=%s", delim, hex); | 61 | htmlf("%cid=%s", delim, hex); |
62 | html("'/>\n"); | 62 | html("'/>\n"); |
63 | } | 63 | } |
64 | htmlf("<id>%s</id>\n", hex); | 64 | htmlf("<id>%s</id>\n", hex); |
@@ -102,24 +102,32 @@ void cgit_print_atom(char *tip, char *path, int max_count) | |||
102 | rev.show_root_diff = 0; | 102 | rev.show_root_diff = 0; |
103 | rev.max_count = max_count; | 103 | rev.max_count = max_count; |
104 | setup_revisions(argc, argv, &rev, NULL); | 104 | setup_revisions(argc, argv, &rev, NULL); |
105 | prepare_revision_walk(&rev); | 105 | prepare_revision_walk(&rev); |
106 | 106 | ||
107 | host = cgit_hosturl(); | 107 | host = cgit_hosturl(); |
108 | ctx.page.mimetype = "text/xml"; | 108 | ctx.page.mimetype = "text/xml"; |
109 | ctx.page.charset = "utf-8"; | 109 | ctx.page.charset = "utf-8"; |
110 | cgit_print_http_headers(&ctx); | 110 | cgit_print_http_headers(&ctx); |
111 | html("<feed xmlns='http://www.w3.org/2005/Atom'>\n"); | 111 | html("<feed xmlns='http://www.w3.org/2005/Atom'>\n"); |
112 | html("<title>"); | 112 | html("<title>"); |
113 | html_txt(ctx.repo->name); | 113 | html_txt(ctx.repo->name); |
114 | if (path) { | ||
115 | html("/"); | ||
116 | html_txt(path); | ||
117 | } | ||
118 | if (tip && !ctx.qry.show_all) { | ||
119 | html(", branch "); | ||
120 | html_txt(tip); | ||
121 | } | ||
114 | html("</title>\n"); | 122 | html("</title>\n"); |
115 | html("<subtitle>"); | 123 | html("<subtitle>"); |
116 | html_txt(ctx.repo->desc); | 124 | html_txt(ctx.repo->desc); |
117 | html("</subtitle>\n"); | 125 | html("</subtitle>\n"); |
118 | if (host) { | 126 | if (host) { |
119 | html("<link rel='alternate' type='text/html' href='"); | 127 | html("<link rel='alternate' type='text/html' href='"); |
120 | html(cgit_httpscheme()); | 128 | html(cgit_httpscheme()); |
121 | html_attr(host); | 129 | html_attr(host); |
122 | html_attr(cgit_repourl(ctx.repo->url)); | 130 | html_attr(cgit_repourl(ctx.repo->url)); |
123 | html("'/>\n"); | 131 | html("'/>\n"); |
124 | } | 132 | } |
125 | while ((commit = get_revision(&rev)) != NULL) { | 133 | while ((commit = get_revision(&rev)) != NULL) { |
@@ -92,25 +92,25 @@ void print_commit(struct commit *commit) | |||
92 | html_link_close(); | 92 | html_link_close(); |
93 | htmlf("</td><td%s>", | 93 | htmlf("</td><td%s>", |
94 | ctx.qry.showmsg ? " class='logsubject'" : ""); | 94 | ctx.qry.showmsg ? " class='logsubject'" : ""); |
95 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, | 95 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
96 | sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0); | 96 | sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0); |
97 | show_commit_decorations(commit); | 97 | show_commit_decorations(commit); |
98 | html("</td><td>"); | 98 | html("</td><td>"); |
99 | html_txt(info->author); | 99 | html_txt(info->author); |
100 | if (ctx.repo->enable_log_filecount) { | 100 | if (ctx.repo->enable_log_filecount) { |
101 | files = 0; | 101 | files = 0; |
102 | add_lines = 0; | 102 | add_lines = 0; |
103 | rem_lines = 0; | 103 | rem_lines = 0; |
104 | cgit_diff_commit(commit, inspect_files); | 104 | cgit_diff_commit(commit, inspect_files, ctx.qry.vpath); |
105 | html("</td><td>"); | 105 | html("</td><td>"); |
106 | htmlf("%d", files); | 106 | htmlf("%d", files); |
107 | if (ctx.repo->enable_log_linecount) { | 107 | if (ctx.repo->enable_log_linecount) { |
108 | html("</td><td>"); | 108 | html("</td><td>"); |
109 | htmlf("-%d/+%d", rem_lines, add_lines); | 109 | htmlf("-%d/+%d", rem_lines, add_lines); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | html("</td></tr>\n"); | 112 | html("</td></tr>\n"); |
113 | if (ctx.qry.showmsg) { | 113 | if (ctx.qry.showmsg) { |
114 | struct strbuf notes = STRBUF_INIT; | 114 | struct strbuf notes = STRBUF_INIT; |
115 | format_note(NULL, commit->object.sha1, ¬es, PAGE_ENCODING, 0); | 115 | format_note(NULL, commit->object.sha1, ¬es, PAGE_ENCODING, 0); |
116 | 116 | ||
@@ -153,25 +153,25 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
153 | { | 153 | { |
154 | struct rev_info rev; | 154 | struct rev_info rev; |
155 | struct commit *commit; | 155 | struct commit *commit; |
156 | const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; | 156 | const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; |
157 | int argc = 2; | 157 | int argc = 2; |
158 | int i, columns = 3; | 158 | int i, columns = 3; |
159 | 159 | ||
160 | if (!tip) | 160 | if (!tip) |
161 | tip = ctx.qry.head; | 161 | tip = ctx.qry.head; |
162 | 162 | ||
163 | argv[1] = disambiguate_ref(tip); | 163 | argv[1] = disambiguate_ref(tip); |
164 | 164 | ||
165 | if (grep && pattern) { | 165 | if (grep && pattern && *pattern) { |
166 | if (!strcmp(grep, "grep") || !strcmp(grep, "author") || | 166 | if (!strcmp(grep, "grep") || !strcmp(grep, "author") || |
167 | !strcmp(grep, "committer")) | 167 | !strcmp(grep, "committer")) |
168 | argv[argc++] = fmt("--%s=%s", grep, pattern); | 168 | argv[argc++] = fmt("--%s=%s", grep, pattern); |
169 | if (!strcmp(grep, "range")) | 169 | if (!strcmp(grep, "range")) |
170 | argv[1] = pattern; | 170 | argv[1] = pattern; |
171 | } | 171 | } |
172 | 172 | ||
173 | if (path) { | 173 | if (path) { |
174 | argv[argc++] = "--"; | 174 | argv[argc++] = "--"; |
175 | argv[argc++] = path; | 175 | argv[argc++] = path; |
176 | } | 176 | } |
177 | init_revisions(&rev, NULL); | 177 | init_revisions(&rev, NULL); |