git: update to v2.19.1

Update to git version v2.19.1. Required changes follow upstream commits:

* commit: add repository argument to get_cached_commit_buffer
  (3ce85f7e5a41116145179f0fae2ce6d86558d099)

* commit: add repository argument to lookup_commit_reference
  (2122f6754c93be8f02bfb5704ed96c88fc9837a8)

* object: add repository argument to parse_object
  (109cd76dd3467bd05f8d2145b857006649741d5c)

* tag: add repository argument to deref_tag
  (a74093da5ed601a09fa158e5ba6f6f14c1142a3e)

* tag: add repository argument to lookup_tag
  (ce71efb713f97f476a2d2ab541a0c73f684a5db3)

* tree: add repository argument to lookup_tree
  (f86bcc7b2ce6cad68ba1a48a528e380c6126705e)

* archive.c: avoid access to the_index
  (b612ee202a48f129f81f8f6a5af6cf71d1a9caef)

* for_each_*_object: move declarations to object-store.h
  (0889aae1cd18c1804ba01c1a4229e516dfb9fe9b)

Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
Christian Hesse 2018-08-28 18:27:00 +02:00
parent a96f2890f4
commit 2c9f56f3e1
15 changed files with 24 additions and 23 deletions

View File

@ -14,7 +14,7 @@ htmldir = $(docdir)
pdfdir = $(docdir) pdfdir = $(docdir)
mandir = $(prefix)/share/man mandir = $(prefix)/share/man
SHA1_HEADER = <openssl/sha.h> SHA1_HEADER = <openssl/sha.h>
GIT_VER = 2.18.0 GIT_VER = 2.19.1
GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
INSTALL = install INSTALL = install
COPYTREE = cp -r COPYTREE = cp -r

1
cgit.h
View File

@ -8,6 +8,7 @@
#include <cache.h> #include <cache.h>
#include <grep.h> #include <grep.h>
#include <object.h> #include <object.h>
#include <object-store.h>
#include <tree.h> #include <tree.h>
#include <commit.h> #include <commit.h>
#include <tag.h> #include <tag.h>

2
git

@ -1 +1 @@
Subproject commit 53f9a3e157dbbc901a02ac2c73346d375e24978c Subproject commit cae598d9980661a978e2df4fb338518f7bf09572

View File

@ -129,7 +129,7 @@ struct commitinfo *cgit_parse_commit(struct commit *commit)
{ {
const int sha1hex_len = 40; const int sha1hex_len = 40;
struct commitinfo *ret; struct commitinfo *ret;
const char *p = get_cached_commit_buffer(commit, NULL); const char *p = get_cached_commit_buffer(the_repository, commit, NULL);
const char *t; const char *t;
ret = xcalloc(1, sizeof(struct commitinfo)); ret = xcalloc(1, sizeof(struct commitinfo));

View File

@ -161,7 +161,7 @@ static struct refinfo *cgit_mk_refinfo(const char *refname, const struct object_
ref = xmalloc(sizeof (struct refinfo)); ref = xmalloc(sizeof (struct refinfo));
ref->refname = xstrdup(refname); ref->refname = xstrdup(refname);
ref->object = parse_object(oid); ref->object = parse_object(the_repository, oid);
switch (ref->object->type) { switch (ref->object->type) {
case OBJ_TAG: case OBJ_TAG:
ref->tag = cgit_parse_tag((struct tag *)ref->object); ref->tag = cgit_parse_tag((struct tag *)ref->object);

View File

@ -278,7 +278,7 @@ void cgit_print_blame(void)
"Invalid revision name: %s", rev); "Invalid revision name: %s", rev);
return; return;
} }
commit = lookup_commit_reference(&oid); commit = lookup_commit_reference(the_repository, &oid);
if (!commit || parse_commit(commit)) { if (!commit || parse_commit(commit)) {
cgit_print_error_page(404, "Not found", cgit_print_error_page(404, "Not found",
"Invalid commit reference: %s", rev); "Invalid commit reference: %s", rev);

View File

@ -56,7 +56,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
goto done; goto done;
if (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT) if (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT)
goto done; goto done;
read_tree_recursive(lookup_commit_reference(&oid)->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); read_tree_recursive(lookup_commit_reference(the_repository, &oid)->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
done: done:
free(path_items.match); free(path_items.match);
@ -89,7 +89,7 @@ int cgit_print_file(char *path, const char *head, int file_only)
return -1; return -1;
type = oid_object_info(the_repository, &oid, &size); type = oid_object_info(the_repository, &oid, &size);
if (type == OBJ_COMMIT) { if (type == OBJ_COMMIT) {
commit = lookup_commit_reference(&oid); commit = lookup_commit_reference(the_repository, &oid);
read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
if (!walk_tree_ctx.found_path) if (!walk_tree_ctx.found_path)
return -1; return -1;
@ -145,7 +145,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
type = oid_object_info(the_repository, &oid, &size); type = oid_object_info(the_repository, &oid, &size);
if ((!hex) && type == OBJ_COMMIT && path) { if ((!hex) && type == OBJ_COMMIT && path) {
commit = lookup_commit_reference(&oid); commit = lookup_commit_reference(the_repository, &oid);
read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx); read_tree_recursive(commit->maybe_tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
type = oid_object_info(the_repository, &oid, &size); type = oid_object_info(the_repository, &oid, &size);
} }

View File

@ -19,12 +19,12 @@ static int print_ref_info(const char *refname, const struct object_id *oid,
{ {
struct object *obj; struct object *obj;
if (!(obj = parse_object(oid))) if (!(obj = parse_object(the_repository, oid)))
return 0; return 0;
htmlf("%s\t%s\n", oid_to_hex(oid), refname); htmlf("%s\t%s\n", oid_to_hex(oid), refname);
if (obj->type == OBJ_TAG) { if (obj->type == OBJ_TAG) {
if (!(obj = deref_tag(obj, refname, 0))) if (!(obj = deref_tag(the_repository, obj, refname, 0)))
return 0; return 0;
htmlf("%s\t%s^{}\n", oid_to_hex(&obj->oid), refname); htmlf("%s\t%s^{}\n", oid_to_hex(&obj->oid), refname);
} }

View File

@ -31,7 +31,7 @@ void cgit_print_commit(char *hex, const char *prefix)
"Bad object id: %s", hex); "Bad object id: %s", hex);
return; return;
} }
commit = lookup_commit_reference(&oid); commit = lookup_commit_reference(the_repository, &oid);
if (!commit) { if (!commit) {
cgit_print_error_page(404, "Not found", cgit_print_error_page(404, "Not found",
"Bad commit reference: %s", hex); "Bad commit reference: %s", hex);
@ -87,7 +87,7 @@ void cgit_print_commit(char *hex, const char *prefix)
free(tmp); free(tmp);
html("</td></tr>\n"); html("</td></tr>\n");
for (p = commit->parents; p; p = p->next) { for (p = commit->parents; p; p = p->next) {
parent = lookup_commit_reference(&p->item->object.oid); parent = lookup_commit_reference(the_repository, &p->item->object.oid);
if (!parent) { if (!parent) {
html("<tr><td colspan='3'>"); html("<tr><td colspan='3'>");
cgit_print_error("Error reading parent commit"); cgit_print_error("Error reading parent commit");

View File

@ -407,7 +407,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
"Bad object name: %s", new_rev); "Bad object name: %s", new_rev);
return; return;
} }
commit = lookup_commit_reference(new_rev_oid); commit = lookup_commit_reference(the_repository, new_rev_oid);
if (!commit || parse_commit(commit)) { if (!commit || parse_commit(commit)) {
cgit_print_error_page(404, "Not found", cgit_print_error_page(404, "Not found",
"Bad commit: %s", oid_to_hex(new_rev_oid)); "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,
} }
if (!is_null_oid(old_rev_oid)) { if (!is_null_oid(old_rev_oid)) {
commit2 = lookup_commit_reference(old_rev_oid); commit2 = lookup_commit_reference(the_repository, old_rev_oid);
if (!commit2 || parse_commit(commit2)) { if (!commit2 || parse_commit(commit2)) {
cgit_print_error_page(404, "Not found", cgit_print_error_page(404, "Not found",
"Bad commit: %s", oid_to_hex(old_rev_oid)); "Bad commit: %s", oid_to_hex(old_rev_oid));

View File

@ -36,7 +36,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
"Bad object id: %s", new_rev); "Bad object id: %s", new_rev);
return; return;
} }
commit = lookup_commit_reference(&new_rev_oid); commit = lookup_commit_reference(the_repository, &new_rev_oid);
if (!commit) { if (!commit) {
cgit_print_error_page(404, "Not found", cgit_print_error_page(404, "Not found",
"Bad commit reference: %s", new_rev); "Bad commit reference: %s", new_rev);
@ -49,7 +49,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
"Bad object id: %s", old_rev); "Bad object id: %s", old_rev);
return; return;
} }
if (!lookup_commit_reference(&old_rev_oid)) { if (!lookup_commit_reference(the_repository, &old_rev_oid)) {
cgit_print_error_page(404, "Not found", cgit_print_error_page(404, "Not found",
"Bad commit reference: %s", old_rev); "Bad commit reference: %s", old_rev);
return; return;

View File

@ -185,7 +185,7 @@ void cgit_print_plain(void)
cgit_print_error_page(404, "Not found", "Not found"); cgit_print_error_page(404, "Not found", "Not found");
return; return;
} }
commit = lookup_commit_reference(&oid); commit = lookup_commit_reference(the_repository, &oid);
if (!commit || parse_commit(commit)) { if (!commit || parse_commit(commit)) {
cgit_print_error_page(404, "Not found", "Not found"); cgit_print_error_page(404, "Not found", "Not found");
return; return;

View File

@ -37,7 +37,7 @@ static int write_archive_type(const char *format, const char *hex, const char *p
/* argv_array guarantees a trailing NULL entry. */ /* argv_array guarantees a trailing NULL entry. */
memcpy(nargv, argv.argv, sizeof(char *) * (argv.argc + 1)); memcpy(nargv, argv.argv, sizeof(char *) * (argv.argc + 1));
result = write_archive(argv.argc, nargv, NULL, NULL, 0); result = write_archive(argv.argc, nargv, NULL, the_repository, NULL, 0);
argv_array_clear(&argv); argv_array_clear(&argv);
free(nargv); free(nargv);
return result; return result;
@ -147,7 +147,7 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
"Bad object id: %s", hex); "Bad object id: %s", hex);
return 1; return 1;
} }
if (!lookup_commit_reference(&oid)) { if (!lookup_commit_reference(the_repository, &oid)) {
cgit_print_error_page(400, "Bad request", cgit_print_error_page(400, "Bad request",
"Not a commit reference: %s", hex); "Not a commit reference: %s", hex);
return 1; return 1;

View File

@ -53,7 +53,7 @@ void cgit_print_tag(char *revname)
"Bad tag reference: %s", revname); "Bad tag reference: %s", revname);
goto cleanup; goto cleanup;
} }
obj = parse_object(&oid); obj = parse_object(the_repository, &oid);
if (!obj) { if (!obj) {
cgit_print_error_page(500, "Internal server error", cgit_print_error_page(500, "Internal server error",
"Bad object id: %s", oid_to_hex(&oid)); "Bad object id: %s", oid_to_hex(&oid));
@ -63,7 +63,7 @@ void cgit_print_tag(char *revname)
struct tag *tag; struct tag *tag;
struct taginfo *info; struct taginfo *info;
tag = lookup_tag(&oid); tag = lookup_tag(the_repository, &oid);
if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) { if (!tag || parse_tag(tag) || !(info = cgit_parse_tag(tag))) {
cgit_print_error_page(500, "Internal server error", cgit_print_error_page(500, "Internal server error",
"Bad tag object: %s", revname); "Bad tag object: %s", revname);

View File

@ -177,7 +177,7 @@ static void write_tree_link(const struct object_id *oid, char *name,
cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev, cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev,
fullpath->buf); fullpath->buf);
tree = lookup_tree(&tree_ctx.oid); tree = lookup_tree(the_repository, &tree_ctx.oid);
if (!tree) if (!tree)
return; return;
@ -359,7 +359,7 @@ void cgit_print_tree(const char *rev, char *path)
"Invalid revision name: %s", rev); "Invalid revision name: %s", rev);
return; return;
} }
commit = lookup_commit_reference(&oid); commit = lookup_commit_reference(the_repository, &oid);
if (!commit || parse_commit(commit)) { if (!commit || parse_commit(commit)) {
cgit_print_error_page(404, "Not found", cgit_print_error_page(404, "Not found",
"Invalid commit reference: %s", rev); "Invalid commit reference: %s", rev);