]> gitweb.ps.run Git - ps-cgit/commitdiff
Merge branch 'tz/make-improvements'
authorLars Hjemli <hjemli@gmail.com>
Tue, 9 Nov 2010 23:28:56 +0000 (00:28 +0100)
committerLars Hjemli <hjemli@gmail.com>
Tue, 9 Nov 2010 23:28:56 +0000 (00:28 +0100)
Makefile
README
cgit.c
cgit.h
cgitrc.5.txt
scan-tree.c
shared.c
ui-atom.c
ui-log.c

index ebf8f039d380c6e7055836ad25aa4fc7f890c158..fe4b10ec16305f8a55e183d8aa0cf01b2683ad8c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-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)
@@ -79,7 +79,7 @@ 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
@@ -139,6 +139,8 @@ 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
diff --git a/README b/README
index 73ec332085cc3afda8023dd805552305c30fc587..050e21ea0f5875ad9349cd6cc08ebd85564a9782 100644 (file)
--- a/README
+++ b/README
@@ -49,7 +49,7 @@ like this:
 
   <Directory "/var/www/htdocs/cgit/">
       AllowOverride None
-      Options ExecCGI
+      Options +ExecCGI
       Order allow,deny
       Allow from all
   </Directory>
diff --git a/cgit.c b/cgit.c
index 96900bb5afbc04f02c0e643b22175c78e3886197..412fbf0c32c4c0d2be3b0973ae5b5804c85059d6 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -121,6 +121,8 @@ void config_cb(const char *name, const char *value)
                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, "/")))
diff --git a/cgit.h b/cgit.h
index 8f5dd2a7f2046eaca5b7eda311efa093f6f0f664..f5f68ac74c76d33110354645aeba464827dec736 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -176,6 +176,7 @@ struct cgit_config {
        char *script_name;
        char *section;
        char *virtual_root;
+       char *strict_export;
        int cache_size;
        int cache_dynamic_ttl;
        int cache_max_create_time;
@@ -293,7 +294,8 @@ 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,...);
index ea1b18ac71e064ebc3247b633d5b64efc32bced1..8e51ca5766945c68c23b1f988062b865cf46397a 100644 (file)
@@ -317,6 +317,13 @@ 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
index b5b50f332b812e4afcd7622a57d84bcf653959a6..a0e09ceac4212c1f8a07ca391d6bc67d6b0cb438 100644 (file)
@@ -81,6 +81,10 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
                        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;
 
index 72ac140d605cfe9b0144d757e041e9dfbb07e5ee..765cd276dd9b0eb947bed9820793d98a18a45a16 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -338,13 +338,13 @@ void cgit_diff_tree(const unsigned char *old_sha1,
        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);
 }
 
index 9f049aea2c2abde2b18959ab63ac9709967b8873..b218456b6e0f4ddc3b57a42f6e542bec31b4be2b 100644 (file)
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -24,7 +24,7 @@ void add_entry(struct commit *commit, char *host)
        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) {
@@ -49,7 +49,7 @@ void add_entry(struct commit *commit, char *host)
        }
        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='");
@@ -111,6 +111,14 @@ void cgit_print_atom(char *tip, char *path, int max_count)
        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);
index 41b5225616933bcc7ab80a155ef0f7ba6c65b4cd..b9771fa772599c73029e7dec351475e363d2360d 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -101,7 +101,7 @@ void print_commit(struct commit *commit)
                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) {
@@ -162,7 +162,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
 
        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);