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

@ -268,7 +268,7 @@ static int ce_compare_link(const struct cache_entry *ce, size_t expected_size)
if (strbuf_readlink(&sb, ce->name, expected_size))
return -1;
buffer = read_object_file(&ce->oid, &type, &size);
buffer = repo_read_object_file(the_repository, &ce->oid, &type, &size);
if (buffer) {
if (size == sb.len)
match = memcmp(buffer, sb.buf, size);
@ -2633,7 +2633,7 @@ int repo_index_has_changes(struct repository *repo,
if (tree)
cmp = tree->object.oid;
if (tree || !get_oid_tree("HEAD", &cmp)) {
if (tree || !repo_get_oid_tree(repo, "HEAD", &cmp)) {
struct diff_options opt;
repo_diff_setup(repo, &opt);
@ -2952,7 +2952,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
}
if (!istate->version)
istate->version = get_index_format_default(the_repository);
istate->version = get_index_format_default(r);
/* demote version 3 to version 2 when the latter suffices */
if (istate->version == 3 || istate->version == 2)
@ -3558,7 +3558,8 @@ void *read_blob_data_from_index(struct index_state *istate,
}
if (pos < 0)
return NULL;
data = read_object_file(&istate->cache[pos]->oid, &type, &sz);
data = repo_read_object_file(the_repository, &istate->cache[pos]->oid,
&type, &sz);
if (!data || type != OBJ_BLOB) {
free(data);
return NULL;