chore(3p/cgit): git: update to v2.32.0

Update to git version v2.32.0, this requires changes for these
upstream commits:

* 47957485b3b731a7860e0554d2bd12c0dce1c75a
  tree.h API: simplify read_tree_recursive() signature

Signed-off-by: Christian Hesse <mail@eworm.de>
Change-Id: I9c37205af2e67d03f9cdd3d39e4fbd611bfa7288
This commit is contained in:
Christian Hesse 2021-05-18 22:49:13 +02:00 committed by Vincent Ambo
parent b0926aa53d
commit 2d8e7dc9d9
5 changed files with 23 additions and 36 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.31.1 GIT_VER = 2.32.0
GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz
INSTALL = install INSTALL = install
COPYTREE = cp -r COPYTREE = cp -r

View file

@ -225,8 +225,7 @@ cleanup:
} }
static int walk_tree(const struct object_id *oid, struct strbuf *base, static int walk_tree(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, int stage, const char *pathname, unsigned mode, void *cbdata)
void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = cbdata; struct walk_tree_context *walk_tree_ctx = cbdata;
@ -295,10 +294,8 @@ void cgit_print_blame(void)
walk_tree_ctx.match_baselen = (path_items.match) ? walk_tree_ctx.match_baselen = (path_items.match) ?
basedir_len(path_items.match) : -1; basedir_len(path_items.match) : -1;
read_tree_recursive(the_repository, read_tree(the_repository, repo_get_commit_tree(the_repository, commit),
repo_get_commit_tree(the_repository, commit), &paths, walk_tree, &walk_tree_ctx);
"", 0, 0,
&paths, walk_tree, &walk_tree_ctx);
if (!walk_tree_ctx.state) if (!walk_tree_ctx.state)
cgit_print_error_page(404, "Not found", "Not found"); cgit_print_error_page(404, "Not found", "Not found");
else if (walk_tree_ctx.state == 2) else if (walk_tree_ctx.state == 2)

View file

@ -19,7 +19,7 @@ struct walk_tree_context {
}; };
static int walk_tree(const struct object_id *oid, struct strbuf *base, static int walk_tree(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *cbdata) const char *pathname, unsigned mode, void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = cbdata; struct walk_tree_context *walk_tree_ctx = cbdata;
@ -56,9 +56,9 @@ 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(the_repository, read_tree(the_repository,
repo_get_commit_tree(the_repository, lookup_commit_reference(the_repository, &oid)), repo_get_commit_tree(the_repository, lookup_commit_reference(the_repository, &oid)),
"", 0, 0, &paths, walk_tree, &walk_tree_ctx); &paths, walk_tree, &walk_tree_ctx);
done: done:
free(path_items.match); free(path_items.match);
@ -92,10 +92,8 @@ int cgit_print_file(char *path, const char *head, int file_only)
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(the_repository, &oid); commit = lookup_commit_reference(the_repository, &oid);
read_tree_recursive(the_repository, read_tree(the_repository, repo_get_commit_tree(the_repository, commit),
repo_get_commit_tree(the_repository, commit), &paths, walk_tree, &walk_tree_ctx);
"", 0, 0, &paths, walk_tree,
&walk_tree_ctx);
if (!walk_tree_ctx.found_path) if (!walk_tree_ctx.found_path)
return -1; return -1;
type = oid_object_info(the_repository, &oid, &size); type = oid_object_info(the_repository, &oid, &size);
@ -151,10 +149,8 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
if ((!hex) && type == OBJ_COMMIT && path) { if ((!hex) && type == OBJ_COMMIT && path) {
commit = lookup_commit_reference(the_repository, &oid); commit = lookup_commit_reference(the_repository, &oid);
read_tree_recursive(the_repository, read_tree(the_repository, repo_get_commit_tree(the_repository, commit),
repo_get_commit_tree(the_repository, commit), &paths, walk_tree, &walk_tree_ctx);
"", 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

@ -130,7 +130,7 @@ static void print_dir_tail(void)
} }
static int walk_tree(const struct object_id *oid, struct strbuf *base, static int walk_tree(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *cbdata) const char *pathname, unsigned mode, void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = cbdata; struct walk_tree_context *walk_tree_ctx = cbdata;
@ -198,9 +198,8 @@ void cgit_print_plain(void)
} }
else else
walk_tree_ctx.match_baselen = basedir_len(path_items.match); walk_tree_ctx.match_baselen = basedir_len(path_items.match);
read_tree_recursive(the_repository, read_tree(the_repository, repo_get_commit_tree(the_repository, commit),
repo_get_commit_tree(the_repository, commit), &paths, walk_tree, &walk_tree_ctx);
"", 0, 0, &paths, walk_tree, &walk_tree_ctx);
if (!walk_tree_ctx.match) if (!walk_tree_ctx.match)
cgit_print_error_page(404, "Not found", "Not found"); cgit_print_error_page(404, "Not found", "Not found");
else if (walk_tree_ctx.match == 2) else if (walk_tree_ctx.match == 2)

View file

@ -141,8 +141,7 @@ struct single_tree_ctx {
}; };
static int single_tree_cb(const struct object_id *oid, struct strbuf *base, static int single_tree_cb(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, int stage, const char *pathname, unsigned mode, void *cbdata)
void *cbdata)
{ {
struct single_tree_ctx *ctx = cbdata; struct single_tree_ctx *ctx = cbdata;
@ -187,8 +186,7 @@ static void write_tree_link(const struct object_id *oid, char *name,
tree_ctx.name = NULL; tree_ctx.name = NULL;
tree_ctx.count = 0; tree_ctx.count = 0;
read_tree_recursive(the_repository, tree, "", 0, 1, read_tree(the_repository, tree, &paths, single_tree_cb, &tree_ctx);
&paths, single_tree_cb, &tree_ctx);
if (tree_ctx.count != 1) if (tree_ctx.count != 1)
break; break;
@ -201,7 +199,7 @@ static void write_tree_link(const struct object_id *oid, char *name,
} }
static int ls_item(const struct object_id *oid, struct strbuf *base, static int ls_item(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *cbdata) const char *pathname, unsigned mode, void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = cbdata; struct walk_tree_context *walk_tree_ctx = cbdata;
char *name; char *name;
@ -314,14 +312,13 @@ static void ls_tree(const struct object_id *oid, const char *path, struct walk_t
} }
ls_head(); ls_head();
read_tree_recursive(the_repository, tree, "", 0, 1, read_tree(the_repository, tree, &paths, ls_item, walk_tree_ctx);
&paths, ls_item, walk_tree_ctx);
ls_tail(); ls_tail();
} }
static int walk_tree(const struct object_id *oid, struct strbuf *base, static int walk_tree(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *cbdata) const char *pathname, unsigned mode, void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = cbdata; struct walk_tree_context *walk_tree_ctx = cbdata;
@ -346,7 +343,7 @@ static int walk_tree(const struct object_id *oid, struct strbuf *base,
return 0; return 0;
} }
} }
ls_item(oid, base, pathname, mode, stage, walk_tree_ctx); ls_item(oid, base, pathname, mode, walk_tree_ctx);
return 0; return 0;
} }
@ -394,10 +391,8 @@ void cgit_print_tree(const char *rev, char *path)
goto cleanup; goto cleanup;
} }
read_tree_recursive(the_repository, read_tree(the_repository, repo_get_commit_tree(the_repository, commit),
repo_get_commit_tree(the_repository, commit), &paths, walk_tree, &walk_tree_ctx);
"", 0, 0,
&paths, walk_tree, &walk_tree_ctx);
if (walk_tree_ctx.state == 1) if (walk_tree_ctx.state == 1)
ls_tail(); ls_tail();
else if (walk_tree_ctx.state == 2) else if (walk_tree_ctx.state == 2)