-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,5 +1,5 @@ -CGIT_VERSION = v0.8.3.3 +CGIT_VERSION = v0.8.3.4 CGIT_SCRIPT_NAME = cgit.cgi CGIT_SCRIPT_PATH = /var/www/htdocs/cgit CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) CGIT_CONFIG = /etc/cgitrc @@ -78,9 +78,9 @@ endif # # Define a pattern rule for automatic dependency building # %.d: %.c - $(QUIET_MM)$(CC) $(CFLAGS) -MM $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@ + $(QUIET_MM)$(CC) $(CFLAGS) -MM -MP $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@ # # Define a pattern rule for silent object building # @@ -138,8 +138,10 @@ CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' +GIT_OPTIONS = prefix=/usr + ifdef NO_ICONV CFLAGS += -DNO_ICONV endif ifdef NO_STRCASESTR @@ -48,9 +48,9 @@ A new Directory-section must probably be added for cgit, possibly something like this: <Directory "/var/www/htdocs/cgit/"> AllowOverride None - Options ExecCGI + Options +ExecCGI Order allow,deny Allow from all </Directory> @@ -120,8 +120,10 @@ void config_cb(const char *name, const char *value) else if (!strcmp(name, "logo-link")) ctx.cfg.logo_link = xstrdup(value); else if (!strcmp(name, "module-link")) ctx.cfg.module_link = xstrdup(value); + else if (!strcmp(name, "strict-export")) + ctx.cfg.strict_export = xstrdup(value); else if (!strcmp(name, "virtual-root")) { ctx.cfg.virtual_root = trim_end(value, '/'); if (!ctx.cfg.virtual_root && (!strcmp(value, "/"))) ctx.cfg.virtual_root = ""; @@ -175,8 +175,9 @@ struct cgit_config { char *root_readme; char *script_name; char *section; char *virtual_root; + char *strict_export; int cache_size; int cache_dynamic_ttl; int cache_max_create_time; int cache_repo_ttl; @@ -292,9 +293,10 @@ extern int cgit_diff_files(const unsigned char *old_sha1, extern void cgit_diff_tree(const unsigned char *old_sha1, const unsigned char *new_sha1, filepair_fn fn, const char *prefix, int ignorews); -extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); +extern void cgit_diff_commit(struct commit *commit, filepair_fn fn, + const char *prefix); __attribute__((format (printf,1,2))) 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 @@ -316,8 +316,15 @@ summary-log:: summary-tags:: Specifies the number of tags to display in the repository "summary" view. Default value: "10". +strict-export:: + Filename which, if specified, needs to be present within the repository + for cgit to allow access to that repository. This can be used to emulate + gitweb's EXPORT_OK and STRICT_EXPORT functionality and limit cgit's + repositories to match those exported by git-daemon. This option MUST come + before 'scan-path'. + virtual-root:: Url which, if specified, will be used as root for all cgit links. It will also cause cgit to generate 'virtual urls', i.e. urls like '/cgit/tree/README' as opposed to '?r=cgit&p=tree&path=README'. Default diff --git a/scan-tree.c b/scan-tree.c index b5b50f3..a0e09ce 100644 --- a/scan-tree.c +++ b/scan-tree.c @@ -80,8 +80,12 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn) fprintf(stderr, "Error accessing %s: %s (%d)\n", path, strerror(errno), errno); return; } + + if (ctx.cfg.strict_export && stat(fmt("%s/%s", path, ctx.cfg.strict_export), &st)) + return; + if (!stat(fmt("%s/noweb", path), &st)) return; owner = NULL; @@ -337,15 +337,15 @@ void cgit_diff_tree(const unsigned char *old_sha1, diffcore_std(&opt); diff_flush(&opt); } -void cgit_diff_commit(struct commit *commit, filepair_fn fn) +void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix) { unsigned char *old_sha1 = NULL; if (commit->parents) old_sha1 = commit->parents->item->object.sha1; - cgit_diff_tree(old_sha1, commit->object.sha1, fn, NULL, + cgit_diff_tree(old_sha1, commit->object.sha1, fn, prefix, ctx.qry.ignorews); } int cgit_parse_snapshots_mask(const char *str) @@ -23,9 +23,9 @@ void add_entry(struct commit *commit, char *host) html("<title>"); html_txt(info->subject); html("</title>\n"); html("<updated>"); - cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); + cgit_print_date(info->committer_date, FMT_ATOMDATE, 0); html("</updated>\n"); html("<author>\n"); if (info->author) { html("<name>"); @@ -48,9 +48,9 @@ void add_entry(struct commit *commit, char *host) free(mail); } html("</author>\n"); html("<published>"); - cgit_print_date(info->author_date, FMT_ATOMDATE, ctx.cfg.local_time); + cgit_print_date(info->author_date, FMT_ATOMDATE, 0); html("</published>\n"); if (host) { html("<link rel='alternate' type='text/html' href='"); html(cgit_httpscheme()); @@ -110,8 +110,16 @@ void cgit_print_atom(char *tip, char *path, int max_count) cgit_print_http_headers(&ctx); html("<feed xmlns='http://www.w3.org/2005/Atom'>\n"); html("<title>"); html_txt(ctx.repo->name); + if (path) { + html("/"); + html_txt(path); + } + if (tip && !ctx.qry.show_all) { + html(", branch "); + html_txt(tip); + } html("</title>\n"); html("<subtitle>"); html_txt(ctx.repo->desc); html("</subtitle>\n"); @@ -100,9 +100,9 @@ void print_commit(struct commit *commit) if (ctx.repo->enable_log_filecount) { files = 0; add_lines = 0; rem_lines = 0; - cgit_diff_commit(commit, inspect_files); + cgit_diff_commit(commit, inspect_files, ctx.qry.vpath); html("</td><td>"); htmlf("%d", files); if (ctx.repo->enable_log_linecount) { html("</td><td>"); @@ -161,9 +161,9 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern tip = ctx.qry.head; argv[1] = disambiguate_ref(tip); - if (grep && pattern) { + if (grep && pattern && *pattern) { if (!strcmp(grep, "grep") || !strcmp(grep, "author") || !strcmp(grep, "committer")) argv[argc++] = fmt("--%s=%s", grep, pattern); if (!strcmp(grep, "range")) |