cocci: apply the "commit.h" part of "the_repository.pending"

Apply the part of "the_repository.pending.cocci" pertaining to
"commit.h".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2023-03-28 15:58:48 +02:00
committed by Junio C Hamano
parent cb338c23d6
commit ecb5091fd4
44 changed files with 196 additions and 174 deletions

View File

@ -1036,7 +1036,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(the_repository, commit))
return MISSING_OBJECT;
if (!idx) {
oidcpy(result, &commit->object.oid);
@ -1070,7 +1070,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(the_repository, commit) || !commit->parents)
return MISSING_OBJECT;
commit = commit->parents->item;
}
@ -1361,10 +1361,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(the_repository, 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(the_repository, commit, buf);
if (matches) {
oidcpy(oid, &commit->object.oid);