diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | cgit.h | 1 | ||||
| m--------- | git | 0 | ||||
| -rw-r--r-- | parsing.c | 2 | ||||
| -rw-r--r-- | shared.c | 2 | ||||
| -rw-r--r-- | ui-blame.c | 2 | ||||
| -rw-r--r-- | ui-blob.c | 6 | ||||
| -rw-r--r-- | ui-clone.c | 4 | ||||
| -rw-r--r-- | ui-commit.c | 4 | ||||
| -rw-r--r-- | ui-diff.c | 4 | ||||
| -rw-r--r-- | ui-patch.c | 4 | ||||
| -rw-r--r-- | ui-plain.c | 2 | ||||
| -rw-r--r-- | ui-snapshot.c | 4 | ||||
| -rw-r--r-- | ui-tag.c | 4 | ||||
| -rw-r--r-- | ui-tree.c | 4 |
15 files changed, 23 insertions, 22 deletions
| @@ -14,7 +14,7 @@ htmldir = $(docdir) | |||
| 14 | pdfdir = $(docdir) | 14 | pdfdir = $(docdir) |
| 15 | mandir = $(prefix)/share/man | 15 | mandir = $(prefix)/share/man |
| 16 | SHA1_HEADER = <openssl/sha.h> | 16 | SHA1_HEADER = <openssl/sha.h> |
| 17 | GIT_VER = 2.18.0 | 17 | GIT_VER = 2.19.1 |
| 18 | GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz | 18 | GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz |
| 19 | INSTALL = install | 19 | INSTALL = install |
| 20 | COPYTREE = cp -r | 20 | COPYTREE = cp -r |
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <cache.h> | 8 | #include <cache.h> |
| 9 | #include <grep.h> | 9 | #include <grep.h> |
| 10 | #include <object.h> | 10 | #include <object.h> |
| 11 | #include <object-store.h> | ||
| 11 | #include <tree.h> | 12 | #include <tree.h> |
| 12 | #include <commit.h> | 13 | #include <commit.h> |
| 13 | #include <tag.h> | 14 | #include <tag.h> |
diff --git a/git b/git | |||
| Subproject 53f9a3e157dbbc901a02ac2c73346d375e24978 | Subproject cae598d9980661a978e2df4fb338518f7bf0957 | ||
| @@ -129,7 +129,7 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) | |||
| 129 | { | 129 | { |
| 130 | const int sha1hex_len = 40; | 130 | const int sha1hex_len = 40; |
| 131 | struct commitinfo *ret; | 131 | struct commitinfo *ret; |
| 132 | const char *p = get_cached_commit_buffer(commit, NULL); | 132 | const char *p = get_cached_commit_buffer(the_repository, commit, NULL); |
| 133 | const char *t; | 133 | const char *t; |
| 134 | 134 | ||
| 135 | ret = xcalloc(1, sizeof(struct commitinfo)); | 135 | ret = xcalloc(1, sizeof(struct commitinfo)); |
| @@ -161,7 +161,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_ | |||
| 161 | 161 | ||
| 162 | ref = xmalloc(sizeof (struct refinfo)); | 162 | ref = xmalloc(sizeof (struct refinfo)); |
| 163 | ref->refname = xstrdup(refname); | 163 | ref->refname = xstrdup(refname); |
| 164 | ref->object = parse_object(oid); | 164 | ref->object = parse_object(the_repository, oid); |
| 165 | switch (ref->object->type) { | 165 | switch (ref->object->type) { |
| 166 | case OBJ_TAG: | 166 | case OBJ_TAG: |
| 167 | ref->tag = cgit_parse_tag((struct tag *)ref->object); | 167 | ref->tag = cgit_parse_tag((struct tag *)ref->object); |
| @@ -278,7 +278,7 @@ void cgit_print_blame(void) | |||
| 278 | "Invalid revision name: %s", rev); | 278 | "Invalid revision name: %s", rev); |
| 279 | return; | 279 | return; |
| 280 | } | 280 | } |
| 281 | commit = lookup_commit_reference(&oid); | 281 | commit = lookup_commit_reference(the_repository, &oid); |
| 282 | if (!commit || parse_commit(commit)) { | 282 | if (!commit || parse_commit(commit)) { |
| 283 | cgit_print_error_page(404, "Not found", | 283 | cgit_print_error_page(404, "Not found", |
| 284 | "Invalid commit reference: %s", rev); | 284 | "Invalid commit reference: %s", rev); |
| @@ -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 (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT) | 57 | if (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT) |
| 58 | goto done; | 58 | goto done; |
| 59 | read_tree_recursive(lookup_commit_reference(&oid)->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 59 | read_tree_recursive(lookup_commit_reference(the_repository, &oid)->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); |
| 60 | 60 | ||
| 61 | done: | 61 | done: |
| 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 = oid_object_info(the_repository, &oid, &size); | 90 | type = oid_object_info(the_repository, &oid, &size); |
| 91 | if (type == OBJ_COMMIT) { | 91 | if (type == OBJ_COMMIT) { |
| 92 | commit = lookup_commit_reference(&oid); | 92 | commit = lookup_commit_reference(the_repository, &oid); |
| 93 | read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 93 | read_tree_recursive(commit->maybe_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 = oid_object_info(the_repository, &oid, &size); | 145 | type = oid_object_info(the_repository, &oid, &size); |
| 146 | 146 | ||
| 147 | if ((!hex) && type == OBJ_COMMIT && path) { | 147 | if ((!hex) && type == OBJ_COMMIT && path) { |
| 148 | commit = lookup_commit_reference(&oid); | 148 | commit = lookup_commit_reference(the_repository, &oid); |
| 149 | read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 149 | read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); |
| 150 | type = oid_object_info(the_repository, &oid, &size); | 150 | type = oid_object_info(the_repository, &oid, &size); |
| 151 | } | 151 | } |
| @@ -19,12 +19,12 @@ static int print_ref_info(const char *refname, const struct object_id *oid, | |||
| 19 | { | 19 | { |
| 20 | struct object *obj; | 20 | struct object *obj; |
| 21 | 21 | ||
| 22 | if (!(obj = parse_object(oid))) | 22 | if (!(obj = parse_object(the_repository, oid))) |
| 23 | return 0; | 23 | return 0; |
| 24 | 24 | ||
| 25 | htmlf("%s\t%s\n", oid_to_hex(oid), refname); | 25 | htmlf("%s\t%s\n", oid_to_hex(oid), refname); |
| 26 | if (obj->type == OBJ_TAG) { | 26 | if (obj->type == OBJ_TAG) { |
| 27 | if (!(obj = deref_tag(obj, refname, 0))) | 27 | if (!(obj = deref_tag(the_repository, obj, refname, 0))) |
| 28 | return 0; | 28 | return 0; |
| 29 | htmlf("%s\t%s^{}\n", oid_to_hex(&obj->oid), refname); | 29 | htmlf("%s\t%s^{}\n", oid_to_hex(&obj->oid), refname); |
| 30 | } | 30 | } |
diff --git a/ui-commit.c b/ui-commit.c index 995cb93..9a47b54 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); | 34 | commit = lookup_commit_reference(the_repository, &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); |
| @@ -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); | 90 | parent = lookup_commit_reference(the_repository, &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"); |
| @@ -407,7 +407,7 @@ 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); | 410 | commit = lookup_commit_reference(the_repository, 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)); |
| @@ -428,7 +428,7 @@ 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); | 431 | commit2 = lookup_commit_reference(the_repository, 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)); |
| @@ -36,7 +36,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, | |||
| 36 | "Bad object id: %s", new_rev); | 36 | "Bad object id: %s", new_rev); |
| 37 | return; | 37 | return; |
| 38 | } | 38 | } |
| 39 | commit = lookup_commit_reference(&new_rev_oid); | 39 | commit = lookup_commit_reference(the_repository, &new_rev_oid); |
| 40 | if (!commit) { | 40 | if (!commit) { |
| 41 | cgit_print_error_page(404, "Not found", | 41 | cgit_print_error_page(404, "Not found", |
| 42 | "Bad commit reference: %s", new_rev); | 42 | "Bad commit reference: %s", new_rev); |
| @@ -49,7 +49,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev, | |||
| 49 | "Bad object id: %s", old_rev); | 49 | "Bad object id: %s", old_rev); |
| 50 | return; | 50 | return; |
| 51 | } | 51 | } |
| 52 | if (!lookup_commit_reference(&old_rev_oid)) { | 52 | if (!lookup_commit_reference(the_repository, &old_rev_oid)) { |
| 53 | cgit_print_error_page(404, "Not found", | 53 | cgit_print_error_page(404, "Not found", |
| 54 | "Bad commit reference: %s", old_rev); | 54 | "Bad commit reference: %s", old_rev); |
| 55 | return; | 55 | return; |
| @@ -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); | 188 | commit = lookup_commit_reference(the_repository, &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 fa3ceaf..85efe64 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c | |||
| @@ -37,7 +37,7 @@ static int write_archive_type(const char *format, const char *hex, const char *p | |||
| 37 | /* argv_array guarantees a trailing NULL entry. */ | 37 | /* argv_array guarantees a trailing NULL entry. */ |
| 38 | memcpy(nargv, argv.argv, sizeof(char *) * (argv.argc + 1)); | 38 | memcpy(nargv, argv.argv, sizeof(char *) * (argv.argc + 1)); |
| 39 | 39 | ||
| 40 | result = write_archive(argv.argc, nargv, NULL, NULL, 0); | 40 | result = write_archive(argv.argc, nargv, NULL, the_repository, NULL, 0); |
| 41 | argv_array_clear(&argv); | 41 | argv_array_clear(&argv); |
| 42 | free(nargv); | 42 | free(nargv); |
| 43 | return result; | 43 | return result; |
| @@ -147,7 +147,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format, | |||
| 147 | "Bad object id: %s", hex); | 147 | "Bad object id: %s", hex); |
| 148 | return 1; | 148 | return 1; |
| 149 | } | 149 | } |
| 150 | if (!lookup_commit_reference(&oid)) { | 150 | if (!lookup_commit_reference(the_repository, &oid)) { |
| 151 | cgit_print_error_page(400, "Bad request", | 151 | cgit_print_error_page(400, "Bad request", |
| 152 | "Not a commit reference: %s", hex); | 152 | "Not a commit reference: %s", hex); |
| 153 | return 1; | 153 | return 1; |
| @@ -53,7 +53,7 @@ void cgit_print_tag(char *revname) | |||
| 53 | "Bad tag reference: %s", revname); | 53 | "Bad tag reference: %s", revname); |
| 54 | goto cleanup; | 54 | goto cleanup; |
| 55 | } | 55 | } |
| 56 | obj = parse_object(&oid); | 56 | obj = parse_object(the_repository, &oid); |
| 57 | if (!obj) { | 57 | if (!obj) { |
| 58 | cgit_print_error_page(500, "Internal server error", | 58 | cgit_print_error_page(500, "Internal server error", |
| 59 | "Bad object id: %s", oid_to_hex(&oid)); | 59 | "Bad object id: %s", oid_to_hex(&oid)); |
| @@ -63,7 +63,7 @@ void cgit_print_tag(char *revname) | |||
| 63 | struct tag *tag; | 63 | struct tag *tag; |
| 64 | struct taginfo *info; | 64 | struct taginfo *info; |
| 65 | 65 | ||
| 66 | tag = lookup_tag(&oid); | 66 | tag = lookup_tag(the_repository, &oid); |
| 67 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { | 67 | if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { |
| 68 | cgit_print_error_page(500, "Internal server error", | 68 | cgit_print_error_page(500, "Internal server error", |
| 69 | "Bad tag object: %s", revname); | 69 | "Bad tag object: %s", revname); |
| @@ -177,7 +177,7 @@ static void write_tree_link(const struct object_id *oid, char *name, | |||
| 177 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev, | 177 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev, |
| 178 | fullpath->buf); | 178 | fullpath->buf); |
| 179 | 179 | ||
| 180 | tree = lookup_tree(&tree_ctx.oid); | 180 | tree = lookup_tree(the_repository, &tree_ctx.oid); |
| 181 | if (!tree) | 181 | if (!tree) |
| 182 | return; | 182 | return; |
| 183 | 183 | ||
| @@ -359,7 +359,7 @@ void cgit_print_tree(const char *rev, char *path) | |||
| 359 | "Invalid revision name: %s", rev); | 359 | "Invalid revision name: %s", rev); |
| 360 | return; | 360 | return; |
| 361 | } | 361 | } |
| 362 | commit = lookup_commit_reference(&oid); | 362 | commit = lookup_commit_reference(the_repository, &oid); |
| 363 | if (!commit || parse_commit(commit)) { | 363 | if (!commit || parse_commit(commit)) { |
| 364 | cgit_print_error_page(404, "Not found", | 364 | cgit_print_error_page(404, "Not found", |
| 365 | "Invalid commit reference: %s", rev); | 365 | "Invalid commit reference: %s", rev); |
