summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2009-12-12 11:09:47 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-12-12 11:09:47 (UTC)
commit547a64fbd65de293c290f4e18bbeae958d54aaa7 (patch) (unidiff)
treee35d8ae4e9408cd552e539c5af08d4bd6fdd1e8f
parent0642435fed6793a0d038e1e5097a91293ee89a05 (diff)
parentc86e206a9773f97dc6de6bbf45712bb304de3653 (diff)
downloadcgit-547a64fbd65de293c290f4e18bbeae958d54aaa7.zip
cgit-547a64fbd65de293c290f4e18bbeae958d54aaa7.tar.gz
cgit-547a64fbd65de293c290f4e18bbeae958d54aaa7.tar.bz2
Merge branch 'stable'
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--ui-blob.c2
-rw-r--r--ui-plain.c2
-rw-r--r--ui-tree.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index f8a4d47..d39a30e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,25 @@
1CGIT_VERSION = v0.8.3 1CGIT_VERSION = v0.8.3.1
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
7SHA1_HEADER = <openssl/sha.h> 7SHA1_HEADER = <openssl/sha.h>
8GIT_VER = 1.6.4.3 8GIT_VER = 1.6.4.3
9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
10INSTALL = install 10INSTALL = install
11 11
12# Define NO_STRCASESTR if you don't have strcasestr. 12# Define NO_STRCASESTR if you don't have strcasestr.
13# 13#
14# Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1 14# Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1
15# implementation (slower). 15# implementation (slower).
16# 16#
17# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). 17# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
18# 18#
19 19
20#-include config.mak 20#-include config.mak
21 21
22# 22#
23# Platform specific tweaks 23# Platform specific tweaks
24# 24#
25 25
diff --git a/ui-blob.c b/ui-blob.c
index 2ccd31d..89330ce 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -29,49 +29,49 @@ void cgit_print_blob(const char *hex, char *path, const char *head)
29 enum object_type type; 29 enum object_type type;
30 char *buf; 30 char *buf;
31 unsigned long size; 31 unsigned long size;
32 struct commit *commit; 32 struct commit *commit;
33 const char *paths[] = {path, NULL}; 33 const char *paths[] = {path, NULL};
34 34
35 if (hex) { 35 if (hex) {
36 if (get_sha1_hex(hex, sha1)){ 36 if (get_sha1_hex(hex, sha1)){
37 cgit_print_error(fmt("Bad hex value: %s", hex)); 37 cgit_print_error(fmt("Bad hex value: %s", hex));
38 return; 38 return;
39 } 39 }
40 } else { 40 } else {
41 if (get_sha1(head,sha1)) { 41 if (get_sha1(head,sha1)) {
42 cgit_print_error(fmt("Bad ref: %s", head)); 42 cgit_print_error(fmt("Bad ref: %s", head));
43 return; 43 return;
44 } 44 }
45 } 45 }
46 46
47 type = sha1_object_info(sha1, &size); 47 type = sha1_object_info(sha1, &size);
48 48
49 if((!hex) && type == OBJ_COMMIT && path) { 49 if((!hex) && type == OBJ_COMMIT && path) {
50 commit = lookup_commit_reference(sha1); 50 commit = lookup_commit_reference(sha1);
51 match_path = path; 51 match_path = path;
52 matched_sha1 = sha1; 52 matched_sha1 = sha1;
53 read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree, NULL); 53 read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL);
54 type = sha1_object_info(sha1,&size); 54 type = sha1_object_info(sha1,&size);
55 } 55 }
56 56
57 if (type == OBJ_BAD) { 57 if (type == OBJ_BAD) {
58 cgit_print_error(fmt("Bad object name: %s", hex)); 58 cgit_print_error(fmt("Bad object name: %s", hex));
59 return; 59 return;
60 } 60 }
61 61
62 buf = read_sha1_file(sha1, &type, &size); 62 buf = read_sha1_file(sha1, &type, &size);
63 if (!buf) { 63 if (!buf) {
64 cgit_print_error(fmt("Error reading object %s", hex)); 64 cgit_print_error(fmt("Error reading object %s", hex));
65 return; 65 return;
66 } 66 }
67 67
68 buf[size] = '\0'; 68 buf[size] = '\0';
69 ctx.page.mimetype = ctx.qry.mimetype; 69 ctx.page.mimetype = ctx.qry.mimetype;
70 if (!ctx.page.mimetype) { 70 if (!ctx.page.mimetype) {
71 if (buffer_is_binary(buf, size)) 71 if (buffer_is_binary(buf, size))
72 ctx.page.mimetype = "application/octet-stream"; 72 ctx.page.mimetype = "application/octet-stream";
73 else 73 else
74 ctx.page.mimetype = "text/plain"; 74 ctx.page.mimetype = "text/plain";
75 } 75 }
76 ctx.page.filename = path; 76 ctx.page.filename = path;
77 cgit_print_http_headers(&ctx); 77 cgit_print_http_headers(&ctx);
diff --git a/ui-plain.c b/ui-plain.c
index a4ce077..66cb19c 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -67,28 +67,28 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
67 return 0; 67 return 0;
68} 68}
69 69
70void cgit_print_plain(struct cgit_context *ctx) 70void cgit_print_plain(struct cgit_context *ctx)
71{ 71{
72 const char *rev = ctx->qry.sha1; 72 const char *rev = ctx->qry.sha1;
73 unsigned char sha1[20]; 73 unsigned char sha1[20];
74 struct commit *commit; 74 struct commit *commit;
75 const char *paths[] = {ctx->qry.path, NULL}; 75 const char *paths[] = {ctx->qry.path, NULL};
76 76
77 if (!rev) 77 if (!rev)
78 rev = ctx->qry.head; 78 rev = ctx->qry.head;
79 79
80 curr_rev = xstrdup(rev); 80 curr_rev = xstrdup(rev);
81 if (get_sha1(rev, sha1)) { 81 if (get_sha1(rev, sha1)) {
82 html_status(404, "Not found", 0); 82 html_status(404, "Not found", 0);
83 return; 83 return;
84 } 84 }
85 commit = lookup_commit_reference(sha1); 85 commit = lookup_commit_reference(sha1);
86 if (!commit || parse_commit(commit)) { 86 if (!commit || parse_commit(commit)) {
87 html_status(404, "Not found", 0); 87 html_status(404, "Not found", 0);
88 return; 88 return;
89 } 89 }
90 match_path = ctx->qry.path; 90 match_path = ctx->qry.path;
91 read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree, NULL); 91 read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL);
92 if (!match) 92 if (!match)
93 html_status(404, "Not found", 0); 93 html_status(404, "Not found", 0);
94} 94}
diff --git a/ui-tree.c b/ui-tree.c
index f281937..94aff8f 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -265,27 +265,27 @@ void cgit_print_tree(const char *rev, char *path)
265 if (!rev) 265 if (!rev)
266 rev = ctx.qry.head; 266 rev = ctx.qry.head;
267 267
268 curr_rev = xstrdup(rev); 268 curr_rev = xstrdup(rev);
269 if (get_sha1(rev, sha1)) { 269 if (get_sha1(rev, sha1)) {
270 cgit_print_error(fmt("Invalid revision name: %s", rev)); 270 cgit_print_error(fmt("Invalid revision name: %s", rev));
271 return; 271 return;
272 } 272 }
273 commit = lookup_commit_reference(sha1); 273 commit = lookup_commit_reference(sha1);
274 if (!commit || parse_commit(commit)) { 274 if (!commit || parse_commit(commit)) {
275 cgit_print_error(fmt("Invalid commit reference: %s", rev)); 275 cgit_print_error(fmt("Invalid commit reference: %s", rev));
276 return; 276 return;
277 } 277 }
278 278
279 html("path: <a href='"); 279 html("path: <a href='");
280 html_attr(cgit_pageurl(ctx.qry.repo, "tree", fmt("h=%s", rev))); 280 html_attr(cgit_pageurl(ctx.qry.repo, "tree", fmt("h=%s", rev)));
281 html("'>root</a>"); 281 html("'>root</a>");
282 282
283 if (path == NULL) { 283 if (path == NULL) {
284 ls_tree(commit->tree->object.sha1, NULL); 284 ls_tree(commit->tree->object.sha1, NULL);
285 return; 285 return;
286 } 286 }
287 287
288 match_path = path; 288 match_path = path;
289 read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree, NULL); 289 read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL);
290 ls_tail(); 290 ls_tail();
291} 291}