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

18
notes.c
View File

@ -789,7 +789,7 @@ static int prune_notes_helper(const struct object_id *object_oid,
struct note_delete_list **l = (struct note_delete_list **) cb_data;
struct note_delete_list *n;
if (has_object_file(object_oid))
if (repo_has_object_file(the_repository, object_oid))
return 0; /* nothing to do for this note */
/* failed to find object => prune this note */
@ -810,13 +810,15 @@ int combine_notes_concatenate(struct object_id *cur_oid,
/* read in both note blob objects */
if (!is_null_oid(new_oid))
new_msg = read_object_file(new_oid, &new_type, &new_len);
new_msg = repo_read_object_file(the_repository, new_oid,
&new_type, &new_len);
if (!new_msg || !new_len || new_type != OBJ_BLOB) {
free(new_msg);
return 0;
}
if (!is_null_oid(cur_oid))
cur_msg = read_object_file(cur_oid, &cur_type, &cur_len);
cur_msg = repo_read_object_file(the_repository, cur_oid,
&cur_type, &cur_len);
if (!cur_msg || !cur_len || cur_type != OBJ_BLOB) {
free(cur_msg);
free(new_msg);
@ -872,7 +874,7 @@ static int string_list_add_note_lines(struct string_list *list,
return 0;
/* read_sha1_file NUL-terminates */
data = read_object_file(oid, &t, &len);
data = repo_read_object_file(the_repository, oid, &t, &len);
if (t != OBJ_BLOB || !data || !len) {
free(data);
return t != OBJ_BLOB || !data;
@ -947,7 +949,7 @@ void string_list_add_refs_by_glob(struct string_list *list, const char *glob)
for_each_glob_ref(string_list_add_one_ref, glob, list);
} else {
struct object_id oid;
if (get_oid(glob, &oid))
if (repo_get_oid(the_repository, glob, &oid))
warning("notes ref %s is invalid", glob);
if (!unsorted_string_list_has_string(list, glob))
string_list_append(list, glob);
@ -1024,7 +1026,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
t->dirty = 0;
if (flags & NOTES_INIT_EMPTY || !notes_ref ||
get_oid_treeish(notes_ref, &object_oid))
repo_get_oid_treeish(the_repository, notes_ref, &object_oid))
return;
if (flags & NOTES_INIT_WRITABLE && read_ref(notes_ref, &object_oid))
die("Cannot use notes ref %s", notes_ref);
@ -1267,7 +1269,7 @@ static void format_note(struct notes_tree *t, const struct object_id *object_oid
if (!oid)
return;
if (!(msg = read_object_file(oid, &type, &msglen)) || type != OBJ_BLOB) {
if (!(msg = repo_read_object_file(the_repository, oid, &type, &msglen)) || type != OBJ_BLOB) {
free(msg);
return;
}
@ -1351,7 +1353,7 @@ void expand_loose_notes_ref(struct strbuf *sb)
{
struct object_id object;
if (get_oid(sb->buf, &object)) {
if (repo_get_oid(the_repository, sb->buf, &object)) {
/* fallback to expand_notes_ref */
expand_notes_ref(sb);
}