summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--Makefile6
-rw-r--r--README2
-rw-r--r--cgit.c2
-rw-r--r--cgit.h4
-rw-r--r--cgitrc.5.txt7
-rw-r--r--scan-tree.c4
-rw-r--r--shared.c4
-rw-r--r--ui-atom.c12
-rw-r--r--ui-log.c4
9 files changed, 35 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index ebf8f03..fe4b10e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1CGIT_VERSION = v0.8.3.3 1CGIT_VERSION = v0.8.3.4
2CGIT_SCRIPT_NAME = cgit.cgi 2CGIT_SCRIPT_NAME = cgit.cgi
3CGIT_SCRIPT_PATH = /var/www/htdocs/cgit 3CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
4CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) 4CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
5CGIT_CONFIG = /etc/cgitrc 5CGIT_CONFIG = /etc/cgitrc
6CACHE_ROOT = /var/cache/cgit 6CACHE_ROOT = /var/cache/cgit
7prefix = /usr 7prefix = /usr
@@ -76,13 +76,13 @@ ifndef V
76endif 76endif
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) $<
@@ -136,12 +136,14 @@ CFLAGS += -g -Wall -Igit
136CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' 136CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
137CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' 137CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
138CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' 138CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
139CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' 139CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
140CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' 140CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'
141 141
142GIT_OPTIONS = prefix=/usr
143
142ifdef NO_ICONV 144ifdef NO_ICONV
143 CFLAGS += -DNO_ICONV 145 CFLAGS += -DNO_ICONV
144endif 146endif
145ifdef NO_STRCASESTR 147ifdef NO_STRCASESTR
146 CFLAGS += -DNO_STRCASESTR 148 CFLAGS += -DNO_STRCASESTR
147endif 149endif
diff --git a/README b/README
index 73ec332..050e21e 100644
--- a/README
+++ b/README
@@ -46,13 +46,13 @@ Apache configuration
46 46
47A new Directory-section must probably be added for cgit, possibly something 47A new Directory-section must probably be added for cgit, possibly something
48like this: 48like 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
58Runtime configuration 58Runtime configuration
diff --git a/cgit.c b/cgit.c
index 96900bb..412fbf0 100644
--- a/cgit.c
+++ b/cgit.c
@@ -118,12 +118,14 @@ void config_cb(const char *name, const char *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);
diff --git a/cgit.h b/cgit.h
index 8f5dd2a..f5f68ac 100644
--- a/cgit.h
+++ b/cgit.h
@@ -173,12 +173,13 @@ struct cgit_config {
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;
@@ -290,13 +291,14 @@ extern int cgit_diff_files(const unsigned char *old_sha1,
290 linediff_fn fn); 291 linediff_fn fn);
291 292
292extern void cgit_diff_tree(const unsigned char *old_sha1, 293extern 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
296extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); 297extern 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)))
299extern char *fmt(const char *format,...); 301extern char *fmt(const char *format,...);
300 302
301extern struct commitinfo *cgit_parse_commit(struct commit *commit); 303extern struct commitinfo *cgit_parse_commit(struct commit *commit);
302extern struct taginfo *cgit_parse_tag(struct tag *tag); 304extern struct taginfo *cgit_parse_tag(struct tag *tag);
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index ea1b18a..8e51ca5 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -314,12 +314,19 @@ summary-log::
314 "summary" view. Default value: "10". 314 "summary" view. Default value: "10".
315 315
316summary-tags:: 316summary-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
320strict-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
320virtual-root:: 327virtual-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
diff --git a/scan-tree.c b/scan-tree.c
index b5b50f3..a0e09ce 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -78,12 +78,16 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
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);
diff --git a/shared.c b/shared.c
index 72ac140..765cd27 100644
--- a/shared.c
+++ b/shared.c
@@ -335,19 +335,19 @@ void cgit_diff_tree(const unsigned char *old_sha1,
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
341void cgit_diff_commit(struct commit *commit, filepair_fn fn) 341void 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
351int cgit_parse_snapshots_mask(const char *str) 351int cgit_parse_snapshots_mask(const char *str)
352{ 352{
353 const struct cgit_snapshot_format *f; 353 const struct cgit_snapshot_format *f;
diff --git a/ui-atom.c b/ui-atom.c
index 9f049ae..b218456 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -21,13 +21,13 @@ void add_entry(struct commit *commit, char *host)
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");
@@ -46,13 +46,13 @@ void add_entry(struct commit *commit, char *host)
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));
@@ -108,12 +108,20 @@ void cgit_print_atom(char *tip, char *path, int max_count)
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='");
diff --git a/ui-log.c b/ui-log.c
index 41b5225..b9771fa 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -98,13 +98,13 @@ void print_commit(struct commit *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 }
@@ -159,13 +159,13 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
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 }