about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
m---------git0
-rw-r--r--scan-tree.c5
-rw-r--r--shared.c6
-rw-r--r--ui-blob.c6
-rw-r--r--ui-clone.c2
-rw-r--r--ui-commit.c6
-rw-r--r--ui-diff.c18
-rw-r--r--ui-log.c10
-rw-r--r--ui-patch.c4
-rw-r--r--ui-plain.c2
-rw-r--r--ui-snapshot.c2
-rw-r--r--ui-tag.c4
-rw-r--r--ui-tree.c18
14 files changed, 43 insertions, 42 deletions
diff --git a/Makefile b/Makefile index 3d792ce..f3ee84c 100644 --- a/Makefile +++ b/Makefile
@@ -14,7 +14,7 @@ htmldir = $(docdir)
14pdfdir = $(docdir) 14pdfdir = $(docdir)
15mandir = $(prefix)/share/man 15mandir = $(prefix)/share/man
16SHA1_HEADER = <openssl/sha.h> 16SHA1_HEADER = <openssl/sha.h>
17GIT_VER = 2.13.4 17GIT_VER = 2.14.0
18GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz 18GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
19INSTALL = install 19INSTALL = install
20COPYTREE = cp -r 20COPYTREE = cp -r
diff --git a/git b/git
Subproject cf8899d285d2648013040ec7196ffd3de060666 Subproject 4384e3cde2ce8ecd194202e171ae16333d24132
diff --git a/scan-tree.c b/scan-tree.c index 08f3f1d..6a2f65a 100644 --- a/scan-tree.c +++ b/scan-tree.c
@@ -10,6 +10,7 @@
10#include "scan-tree.h" 10#include "scan-tree.h"
11#include "configfile.h" 11#include "configfile.h"
12#include "html.h" 12#include "html.h"
13#include <config.h>
13 14
14/* return 1 if path contains a objects/ directory and a HEAD file */ 15/* return 1 if path contains a objects/ directory and a HEAD file */
15static int is_git_dir(const char *path) 16static int is_git_dir(const char *path)
@@ -48,7 +49,7 @@ out:
48static struct cgit_repo *repo; 49static struct cgit_repo *repo;
49static repo_config_fn config_fn; 50static repo_config_fn config_fn;
50 51
51static void repo_config(const char *name, const char *value) 52static void scan_tree_repo_config(const char *name, const char *value)
52{ 53{
53 config_fn(repo, name, value); 54 config_fn(repo, name, value);
54} 55}
@@ -178,7 +179,7 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
178 179
179 strbuf_addstr(path, "cgitrc"); 180 strbuf_addstr(path, "cgitrc");
180 if (!stat(path->buf, &st)) 181 if (!stat(path->buf, &st))
181 parse_configfile(path->buf, &repo_config); 182 parse_configfile(path->buf, &scan_tree_repo_config);
182 183
183 strbuf_release(&rel); 184 strbuf_release(&rel);
184} 185}
diff --git a/shared.c b/shared.c index 13a65a9..df3f611 100644 --- a/shared.c +++ b/shared.c
@@ -160,7 +160,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_
160 160
161 ref = xmalloc(sizeof (struct refinfo)); 161 ref = xmalloc(sizeof (struct refinfo));
162 ref->refname = xstrdup(refname); 162 ref->refname = xstrdup(refname);
163 ref->object = parse_object(oid->hash); 163 ref->object = parse_object(oid);
164 switch (ref->object->type) { 164 switch (ref->object->type) {
165 case OBJ_TAG: 165 case OBJ_TAG:
166 ref->tag = cgit_parse_tag((struct tag *)ref->object); 166 ref->tag = cgit_parse_tag((struct tag *)ref->object);
@@ -360,9 +360,9 @@ void cgit_diff_tree(const struct object_id *old_oid,
360 diff_setup_done(&opt); 360 diff_setup_done(&opt);
361 361
362 if (old_oid && !is_null_oid(old_oid)) 362 if (old_oid && !is_null_oid(old_oid))
363 diff_tree_sha1(old_oid->hash, new_oid->hash, "", &opt); 363 diff_tree_oid(old_oid, new_oid, "", &opt);
364 else 364 else
365 diff_root_tree_sha1(new_oid->hash, "", &opt); 365 diff_root_tree_oid(new_oid, "", &opt);
366 diffcore_std(&opt); 366 diffcore_std(&opt);
367 diff_flush(&opt); 367 diff_flush(&opt);
368 368
diff --git a/ui-blob.c b/ui-blob.c index 793817f..761e886 100644 --- a/ui-blob.c +++ b/ui-blob.c
@@ -56,7 +56,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
56 goto done; 56 goto done;
57 if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT) 57 if (sha1_object_info(oid.hash, &size) != OBJ_COMMIT)
58 goto done; 58 goto done;
59 read_tree_recursive(lookup_commit_reference(oid.hash)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); 59 read_tree_recursive(lookup_commit_reference(&oid)->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
60 60
61done: 61done:
62 free(path_items.match); 62 free(path_items.match);
@@ -89,7 +89,7 @@ int cgit_print_file(char *path, const char *head, int file_only)
89 return -1; 89 return -1;
90 type = sha1_object_info(oid.hash, &size); 90 type = sha1_object_info(oid.hash, &size);
91 if (type == OBJ_COMMIT) { 91 if (type == OBJ_COMMIT) {
92 commit = lookup_commit_reference(oid.hash); 92 commit = lookup_commit_reference(&oid);
93 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); 93 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
94 if (!walk_tree_ctx.found_path) 94 if (!walk_tree_ctx.found_path)
95 return -1; 95 return -1;
@@ -145,7 +145,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
145 type = sha1_object_info(oid.hash, &size); 145 type = sha1_object_info(oid.hash, &size);
146 146
147 if ((!hex) && type == OBJ_COMMIT && path) { 147 if ((!hex) && type == OBJ_COMMIT && path) {
148 commit = lookup_commit_reference(oid.hash); 148 commit = lookup_commit_reference(&oid);
149 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); 149 read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
150 type = sha1_object_info(oid.hash, &size); 150 type = sha1_object_info(oid.hash, &size);
151 } 151 }
diff --git a/ui-clone.c b/ui-clone.c index 5f6606a..0d11672 100644 --- a/ui-clone.c +++ b/ui-clone.c
@@ -17,7 +17,7 @@ static int print_ref_info(const char *refname, const struct object_id *oid,
17{ 17{
18 struct object *obj; 18 struct object *obj;
19 19
20 if (!(obj = parse_object(oid->hash))) 20 if (!(obj = parse_object(oid)))
21 return 0; 21 return 0;
22 22
23 htmlf("%s\t%s\n", oid_to_hex(oid), refname); 23 htmlf("%s\t%s\n", oid_to_hex(oid), refname);
diff --git a/ui-commit.c b/ui-commit.c index db69d54..586fea0 100644 --- a/ui-commit.c +++ b/ui-commit.c
@@ -31,7 +31,7 @@ void cgit_print_commit(char *hex, const char *prefix)
31 "Bad object id: %s", hex); 31 "Bad object id: %s", hex);
32 return; 32 return;
33 } 33 }
34 commit = lookup_commit_reference(oid.hash); 34 commit = lookup_commit_reference(&oid);
35 if (!commit) { 35 if (!commit) {
36 cgit_print_error_page(404, "Not found", 36 cgit_print_error_page(404, "Not found",
37 "Bad commit reference: %s", hex); 37 "Bad commit reference: %s", hex);
@@ -39,7 +39,7 @@ void cgit_print_commit(char *hex, const char *prefix)
39 } 39 }
40 info = cgit_parse_commit(commit); 40 info = cgit_parse_commit(commit);
41 41
42 format_display_notes(oid.hash, &notes, PAGE_ENCODING, 0); 42 format_display_notes(&oid, &notes, PAGE_ENCODING, 0);
43 43
44 load_ref_decorations(DECORATE_FULL_REFS); 44 load_ref_decorations(DECORATE_FULL_REFS);
45 45
@@ -87,7 +87,7 @@ void cgit_print_commit(char *hex, const char *prefix)
87 free(tmp); 87 free(tmp);
88 html("</td></tr>\n"); 88 html("</td></tr>\n");
89 for (p = commit->parents; p; p = p->next) { 89 for (p = commit->parents; p; p = p->next) {
90 parent = lookup_commit_reference(p->item->object.oid.hash); 90 parent = lookup_commit_reference(&p->item->object.oid);
91 if (!parent) { 91 if (!parent) {
92 html("<tr><td colspan='3'>"); 92 html("<tr><td colspan='3'>");
93 cgit_print_error("Error reading parent commit"); 93 cgit_print_error("Error reading parent commit");
diff --git a/ui-diff.c b/ui-diff.c index 173d351..c7fb49b 100644 --- a/ui-diff.c +++ b/ui-diff.c
@@ -385,7 +385,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
385 const char *prefix, int show_ctrls, int raw) 385 const char *prefix, int show_ctrls, int raw)
386{ 386{
387 struct commit *commit, *commit2; 387 struct commit *commit, *commit2;
388 const unsigned char *old_tree_sha1, *new_tree_sha1; 388 const struct object_id *old_tree_oid, *new_tree_oid;
389 diff_type difftype; 389 diff_type difftype;
390 390
391 /* 391 /*
@@ -407,13 +407,13 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
407 "Bad object name: %s", new_rev); 407 "Bad object name: %s", new_rev);
408 return; 408 return;
409 } 409 }
410 commit = lookup_commit_reference(new_rev_oid->hash); 410 commit = lookup_commit_reference(new_rev_oid);
411 if (!commit || parse_commit(commit)) { 411 if (!commit || parse_commit(commit)) {
412 cgit_print_error_page(404, "Not found", 412 cgit_print_error_page(404, "Not found",
413 "Bad commit: %s", oid_to_hex(new_rev_oid)); 413 "Bad commit: %s", oid_to_hex(new_rev_oid));
414 return; 414 return;
415 } 415 }
416 new_tree_sha1 = commit->tree->object.oid.hash; 416 new_tree_oid = &commit->tree->object.oid;
417 417
418 if (old_rev) { 418 if (old_rev) {
419 if (get_oid(old_rev, old_rev_oid)) { 419 if (get_oid(old_rev, old_rev_oid)) {
@@ -428,15 +428,15 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
428 } 428 }
429 429
430 if (!is_null_oid(old_rev_oid)) { 430 if (!is_null_oid(old_rev_oid)) {
431 commit2 = lookup_commit_reference(old_rev_oid->hash); 431 commit2 = lookup_commit_reference(old_rev_oid);
432 if (!commit2 || parse_commit(commit2)) { 432 if (!commit2 || parse_commit(commit2)) {
433 cgit_print_error_page(404, "Not found", 433 cgit_print_error_page(404, "Not found",
434 "Bad commit: %s", oid_to_hex(old_rev_oid)); 434 "Bad commit: %s", oid_to_hex(old_rev_oid));
435 return; 435 return;
436 } 436 }
437 old_tree_sha1 = commit2->tree->object.oid.hash; 437 old_tree_oid = &commit2->tree->object.oid;
438 } else { 438 } else {
439 old_tree_sha1 = NULL; 439 old_tree_oid = NULL;
440 } 440 }
441 441
442 if (raw) { 442 if (raw) {
@@ -449,11 +449,11 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
449 449
450 ctx.page.mimetype = "text/plain"; 450 ctx.page.mimetype = "text/plain";
451 cgit_print_http_headers(); 451 cgit_print_http_headers();
452 if (old_tree_sha1) { 452 if (old_tree_oid) {
453 diff_tree_sha1(old_tree_sha1, new_tree_sha1, "", 453 diff_tree_oid(old_tree_oid, new_tree_oid, "",
454 &diffopt); 454 &diffopt);
455 } else { 455 } else {
456 diff_root_tree_sha1(new_tree_sha1, "", &diffopt); 456 diff_root_tree_oid(new_tree_oid, "", &diffopt);
457 } 457 }
458 diffcore_std(&diffopt); 458 diffcore_std(&diffopt);
459 diff_flush(&diffopt); 459 diff_flush(&diffopt);
diff --git a/ui-log.c b/ui-log.c index 3220fd9..2d2bb31 100644 --- a/ui-log.c +++ b/ui-log.c
@@ -150,9 +150,9 @@ static int show_commit(struct commit *commit, struct rev_info *revs)
150 rem_lines = 0; 150 rem_lines = 0;
151 151
152 DIFF_OPT_SET(&revs->diffopt, RECURSIVE); 152 DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
153 diff_tree_sha1(parent->tree->object.oid.hash, 153 diff_tree_oid(&parent->tree->object.oid,
154 commit->tree->object.oid.hash, 154 &commit->tree->object.oid,
155 "", &revs->diffopt); 155 "", &revs->diffopt);
156 diffcore_std(&revs->diffopt); 156 diffcore_std(&revs->diffopt);
157 157
158 found = !diff_queue_is_empty(); 158 found = !diff_queue_is_empty();
@@ -273,7 +273,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
273 strbuf_addstr(&msgbuf, info->msg); 273 strbuf_addstr(&msgbuf, info->msg);
274 strbuf_addch(&msgbuf, '\n'); 274 strbuf_addch(&msgbuf, '\n');
275 } 275 }
276 format_display_notes(commit->object.oid.hash, 276 format_display_notes(&commit->object.oid,
277 &msgbuf, PAGE_ENCODING, 0); 277 &msgbuf, PAGE_ENCODING, 0);
278 strbuf_addch(&msgbuf, '\n'); 278 strbuf_addch(&msgbuf, '\n');
279 strbuf_ltrim(&msgbuf); 279 strbuf_ltrim(&msgbuf);
@@ -436,7 +436,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
436 setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL); 436 setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL);
437 load_ref_decorations(DECORATE_FULL_REFS); 437 load_ref_decorations(DECORATE_FULL_REFS);
438 rev.show_decorations = 1; 438 rev.show_decorations = 1;
439 rev.grep_filter.regflags |= REG_ICASE; 439 rev.grep_filter.ignore_case = 1;
440 440
441 rev.diffopt.detect_rename = 1; 441 rev.diffopt.detect_rename = 1;
442 rev.diffopt.rename_limit = ctx.cfg.renamelimit; 442 rev.diffopt.rename_limit = ctx.cfg.renamelimit;
diff --git a/ui-patch.c b/ui-patch.c index 047e2f9..69aa4a8 100644 --- a/ui-patch.c +++ b/ui-patch.c
@@ -33,7 +33,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
33 "Bad object id: %s", new_rev); 33 "Bad object id: %s", new_rev);
34 return; 34 return;
35 } 35 }
36 commit = lookup_commit_reference(new_rev_oid.hash); 36 commit = lookup_commit_reference(&new_rev_oid);
37 if (!commit) { 37 if (!commit) {
38 cgit_print_error_page(404, "Not found", 38 cgit_print_error_page(404, "Not found",
39 "Bad commit reference: %s", new_rev); 39 "Bad commit reference: %s", new_rev);
@@ -46,7 +46,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
46 "Bad object id: %s", old_rev); 46 "Bad object id: %s", old_rev);
47 return; 47 return;
48 } 48 }
49 if (!lookup_commit_reference(old_rev_oid.hash)) { 49 if (!lookup_commit_reference(&old_rev_oid)) {
50 cgit_print_error_page(404, "Not found", 50 cgit_print_error_page(404, "Not found",
51 "Bad commit reference: %s", old_rev); 51 "Bad commit reference: %s", old_rev);
52 return; 52 return;
diff --git a/ui-plain.c b/ui-plain.c index 8d541e3..e45d553 100644 --- a/ui-plain.c +++ b/ui-plain.c
@@ -185,7 +185,7 @@ void cgit_print_plain(void)
185 cgit_print_error_page(404, "Not found", "Not found"); 185 cgit_print_error_page(404, "Not found", "Not found");
186 return; 186 return;
187 } 187 }
188 commit = lookup_commit_reference(oid.hash); 188 commit = lookup_commit_reference(&oid);
189 if (!commit || parse_commit(commit)) { 189 if (!commit || parse_commit(commit)) {
190 cgit_print_error_page(404, "Not found", "Not found"); 190 cgit_print_error_page(404, "Not found", "Not found");
191 return; 191 return;
diff --git a/ui-snapshot.c b/ui-snapshot.c index 9b8cddd..b2d95f7 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c
@@ -116,7 +116,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
116 "Bad object id: %s", hex); 116 "Bad object id: %s", hex);
117 return 1; 117 return 1;
118 } 118 }
119 if (!lookup_commit_reference(oid.hash)) { 119 if (!lookup_commit_reference(&oid)) {
120 cgit_print_error_page(400, "Bad request", 120 cgit_print_error_page(400, "Bad request",
121 "Not a commit reference: %s", hex); 121 "Not a commit reference: %s", hex);
122 return 1; 122 return 1;
diff --git a/ui-tag.c b/ui-tag.c index afd7d61..909cde0 100644 --- a/ui-tag.c +++ b/ui-tag.c
@@ -54,7 +54,7 @@ void cgit_print_tag(char *revname)
54 "Bad tag reference: %s", revname); 54 "Bad tag reference: %s", revname);
55 goto cleanup; 55 goto cleanup;
56 } 56 }
57 obj = parse_object(oid.hash); 57 obj = parse_object(&oid);
58 if (!obj) { 58 if (!obj) {
59 cgit_print_error_page(500, "Internal server error", 59 cgit_print_error_page(500, "Internal server error",
60 "Bad object id: %s", oid_to_hex(&oid)); 60 "Bad object id: %s", oid_to_hex(&oid));
@@ -64,7 +64,7 @@ void cgit_print_tag(char *revname)
64 struct tag *tag; 64 struct tag *tag;
65 struct taginfo *info; 65 struct taginfo *info;
66 66
67 tag = lookup_tag(oid.hash); 67 tag = lookup_tag(&oid);
68 if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { 68 if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {
69 cgit_print_error_page(500, "Internal server error", 69 cgit_print_error_page(500, "Internal server error",
70 "Bad tag object: %s", revname); 70 "Bad tag object: %s", revname);
diff --git a/ui-tree.c b/ui-tree.c index b310242..ca24a03 100644 --- a/ui-tree.c +++ b/ui-tree.c
@@ -157,7 +157,7 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
157 157
158struct single_tree_ctx { 158struct single_tree_ctx {
159 struct strbuf *path; 159 struct strbuf *path;
160 unsigned char sha1[GIT_SHA1_RAWSZ]; 160 struct object_id oid;
161 char *name; 161 char *name;
162 size_t count; 162 size_t count;
163}; 163};
@@ -177,7 +177,7 @@ static int single_tree_cb(const unsigned char *sha1, struct strbuf *base,
177 } 177 }
178 178
179 ctx->name = xstrdup(pathname); 179 ctx->name = xstrdup(pathname);
180 hashcpy(ctx->sha1, sha1); 180 hashcpy(ctx->oid.hash, sha1);
181 strbuf_addf(ctx->path, "/%s", pathname); 181 strbuf_addf(ctx->path, "/%s", pathname);
182 return 0; 182 return 0;
183} 183}
@@ -195,13 +195,13 @@ static void write_tree_link(const unsigned char *sha1, char *name,
195 .nr = 0 195 .nr = 0
196 }; 196 };
197 197
198 hashcpy(tree_ctx.sha1, sha1); 198 hashcpy(tree_ctx.oid.hash, sha1);
199 199
200 while (tree_ctx.count == 1) { 200 while (tree_ctx.count == 1) {
201 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev, 201 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev,
202 fullpath->buf); 202 fullpath->buf);
203 203
204 tree = lookup_tree(tree_ctx.sha1); 204 tree = lookup_tree(&tree_ctx.oid);
205 if (!tree) 205 if (!tree)
206 return; 206 return;
207 207
@@ -300,17 +300,17 @@ static void ls_tail(void)
300 cgit_print_layout_end(); 300 cgit_print_layout_end();
301} 301}
302 302
303static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_context *walk_tree_ctx) 303static void ls_tree(const struct object_id *oid, char *path, struct walk_tree_context *walk_tree_ctx)
304{ 304{
305 struct tree *tree; 305 struct tree *tree;
306 struct pathspec paths = { 306 struct pathspec paths = {
307 .nr = 0 307 .nr = 0
308 }; 308 };
309 309
310 tree = parse_tree_indirect(sha1); 310 tree = parse_tree_indirect(oid);
311 if (!tree) { 311 if (!tree) {
312 cgit_print_error_page(404, "Not found", 312 cgit_print_error_page(404, "Not found",
313 "Not a tree object: %s", sha1_to_hex(sha1)); 313 "Not a tree object: %s", sha1_to_hex(oid->hash));
314 return; 314 return;
315 } 315 }
316 316
@@ -380,7 +380,7 @@ void cgit_print_tree(const char *rev, char *path)
380 "Invalid revision name: %s", rev); 380 "Invalid revision name: %s", rev);
381 return; 381 return;
382 } 382 }
383 commit = lookup_commit_reference(oid.hash); 383 commit = lookup_commit_reference(&oid);
384 if (!commit || parse_commit(commit)) { 384 if (!commit || parse_commit(commit)) {
385 cgit_print_error_page(404, "Not found", 385 cgit_print_error_page(404, "Not found",
386 "Invalid commit reference: %s", rev); 386 "Invalid commit reference: %s", rev);
@@ -390,7 +390,7 @@ void cgit_print_tree(const char *rev, char *path)
390 walk_tree_ctx.curr_rev = xstrdup(rev); 390 walk_tree_ctx.curr_rev = xstrdup(rev);
391 391
392 if (path == NULL) { 392 if (path == NULL) {
393 ls_tree(commit->tree->object.oid.hash, NULL, &walk_tree_ctx); 393 ls_tree(&commit->tree->object.oid, NULL, &walk_tree_ctx);
394 goto cleanup; 394 goto cleanup;
395 } 395 }
396 396