diff options
| -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,4 +1,4 @@ | |||
| 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) |
| @@ -79,7 +79,7 @@ endif | |||
| 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 |
| @@ -139,6 +139,8 @@ 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 |
| @@ -49,7 +49,7 @@ 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> |
| @@ -121,6 +121,8 @@ void config_cb(const char *name, const char *value) | |||
| 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, "/"))) |
| @@ -176,6 +176,7 @@ struct cgit_config { | |||
| 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; |
| @@ -293,7 +294,8 @@ 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,...); |
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index ea1b18a..8e51ca5 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
| @@ -317,6 +317,13 @@ 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 |
diff --git a/scan-tree.c b/scan-tree.c index b5b50f3..a0e09ce 100644 --- a/scan-tree.c +++ b/scan-tree.c | |||
| @@ -81,6 +81,10 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) | |||
| 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 | ||
| @@ -338,13 +338,13 @@ void cgit_diff_tree(const unsigned char *old_sha1, | |||
| 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 | ||
| @@ -24,7 +24,7 @@ void add_entry(struct commit *commit, char *host) | |||
| 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) { |
| @@ -49,7 +49,7 @@ void add_entry(struct commit *commit, char *host) | |||
| 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='"); |
| @@ -111,6 +111,14 @@ void cgit_print_atom(char *tip, char *path, int max_count) | |||
| 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); |
| @@ -101,7 +101,7 @@ void print_commit(struct commit *commit) | |||
| 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) { |
| @@ -162,7 +162,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern | |||
| 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); |
