From d850b7a545fcfbd97460a921c7f7c59d933eb0f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 28 Mar 2023 15:58:46 +0200 Subject: cocci: apply the "cache.h" part of "the_repository.pending" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply the part of "the_repository.pending.cocci" pertaining to "cache.h". Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- notes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'notes.c') diff --git a/notes.c b/notes.c index f2805d51bb..750e18c400 100644 --- a/notes.c +++ b/notes.c @@ -944,7 +944,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); @@ -1021,7 +1021,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); @@ -1348,7 +1348,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); } -- cgit v1.2.3 From bc726bd075929aab6b3e09d4dd5c2b0726fd5350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 28 Mar 2023 15:58:50 +0200 Subject: cocci: apply the "object-store.h" part of "the_repository.pending" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply the part of "the_repository.pending.cocci" pertaining to "object-store.h". Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- notes.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'notes.c') diff --git a/notes.c b/notes.c index 750e18c400..e4dab62cad 100644 --- a/notes.c +++ b/notes.c @@ -786,7 +786,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 */ @@ -807,13 +807,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); @@ -869,7 +871,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; @@ -1264,7 +1266,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; } -- cgit v1.2.3