Merge branch 'ab/remove-implicit-use-of-the-repository' into en/header-split-cache-h

* ab/remove-implicit-use-of-the-repository:
  libs: use "struct repository *" argument, not "the_repository"
  post-cocci: adjust comments for recent repo_* migration
  cocci: apply the "revision.h" part of "the_repository.pending"
  cocci: apply the "rerere.h" part of "the_repository.pending"
  cocci: apply the "refs.h" part of "the_repository.pending"
  cocci: apply the "promisor-remote.h" part of "the_repository.pending"
  cocci: apply the "packfile.h" part of "the_repository.pending"
  cocci: apply the "pretty.h" part of "the_repository.pending"
  cocci: apply the "object-store.h" part of "the_repository.pending"
  cocci: apply the "diff.h" part of "the_repository.pending"
  cocci: apply the "commit.h" part of "the_repository.pending"
  cocci: apply the "commit-reach.h" part of "the_repository.pending"
  cocci: apply the "cache.h" part of "the_repository.pending"
  cocci: add missing "the_repository" macros to "pending"
  cocci: sort "the_repository" rules by header
  cocci: fix incorrect & verbose "the_repository" rules
  cocci: remove dead rule from "the_repository.pending.cocci"
This commit is contained in:
Junio C Hamano
2023-04-04 08:25:52 -07:00
148 changed files with 958 additions and 873 deletions

View File

@ -398,8 +398,10 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
if (commit) {
struct pretty_print_context pp = {0};
pp.date_mode.type = DATE_SHORT;
format_commit_message(commit, "%ad", &date, &pp);
format_commit_message(commit, "%s", &msg, &pp);
repo_format_commit_message(the_repository, commit,
"%ad", &date, &pp);
repo_format_commit_message(the_repository, commit,
"%s", &msg, &pp);
}
/*
@ -1040,7 +1042,7 @@ static enum get_oid_result get_parent(struct repository *r,
if (ret)
return ret;
commit = lookup_commit_reference(r, &oid);
if (parse_commit(commit))
if (repo_parse_commit(r, commit))
return MISSING_OBJECT;
if (!idx) {
oidcpy(result, &commit->object.oid);
@ -1074,7 +1076,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r,
return MISSING_OBJECT;
while (generation--) {
if (parse_commit(commit) || !commit->parents)
if (repo_parse_commit(r, commit) || !commit->parents)
return MISSING_OBJECT;
commit = commit->parents->item;
}
@ -1365,10 +1367,10 @@ static int get_oid_oneline(struct repository *r,
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
if (!parse_object(r, &commit->object.oid))
continue;
buf = get_commit_buffer(commit, NULL);
buf = repo_get_commit_buffer(r, commit, NULL);
p = strstr(buf, "\n\n");
matches = negative ^ (p && !regexec(&regex, p + 2, 0, NULL, 0));
unuse_commit_buffer(commit, buf);
repo_unuse_commit_buffer(r, commit, buf);
if (matches) {
oidcpy(oid, &commit->object.oid);
@ -1670,7 +1672,8 @@ void strbuf_branchname(struct strbuf *sb, const char *name, unsigned allowed)
struct interpret_branch_name_options options = {
.allowed = allowed
};
int used = interpret_branch_name(name, len, sb, &options);
int used = repo_interpret_branch_name(the_repository, name, len, sb,
&options);
if (used < 0)
used = 0;
@ -1723,7 +1726,7 @@ int get_oidf(struct object_id *oid, const char *fmt, ...)
strbuf_vaddf(&sb, fmt, ap);
va_end(ap);
ret = get_oid(sb.buf, oid);
ret = repo_get_oid(the_repository, sb.buf, oid);
strbuf_release(&sb);
return ret;