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

Apply the part of "the_repository.pending.cocci" pertaining to
"cache.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:46 +02:00
committed by Junio C Hamano
parent 7258e892d2
commit d850b7a545
79 changed files with 332 additions and 310 deletions

View File

@ -235,7 +235,7 @@ static int bisect_reset(const char *commit)
} else {
struct object_id oid;
if (get_oid_commit(commit, &oid))
if (repo_get_oid_commit(the_repository, commit, &oid))
return error(_("'%s' is not a valid commit"), commit);
strbuf_addstr(&branch, commit);
}
@ -292,7 +292,7 @@ static int bisect_write(const char *state, const char *rev,
goto finish;
}
if (get_oid(rev, &oid)) {
if (repo_get_oid(the_repository, rev, &oid)) {
res = error(_("couldn't get the oid of the rev '%s'"), rev);
goto finish;
}
@ -775,7 +775,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
*/
head = resolve_ref_unsafe("HEAD", 0, &head_oid, &flags);
if (!head)
if (get_oid("HEAD", &head_oid))
if (repo_get_oid(the_repository, "HEAD", &head_oid))
return error(_("bad HEAD - I need a HEAD"));
/*
@ -801,11 +801,11 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
}
} else {
/* Get the rev from where we start. */
if (!get_oid(head, &head_oid) &&
if (!repo_get_oid(the_repository, head, &head_oid) &&
!starts_with(head, "refs/heads/")) {
strbuf_reset(&start_head);
strbuf_addstr(&start_head, oid_to_hex(&head_oid));
} else if (!get_oid(head, &head_oid) &&
} else if (!repo_get_oid(the_repository, head, &head_oid) &&
skip_prefix(head, "refs/heads/", &head)) {
strbuf_addstr(&start_head, head);
} else {
@ -828,7 +828,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
write_file(git_path_bisect_first_parent(), "\n");
if (no_checkout) {
if (get_oid(start_head.buf, &oid) < 0) {
if (repo_get_oid(the_repository, start_head.buf, &oid) < 0) {
res = error(_("invalid ref: '%s'"), start_head.buf);
goto finish;
}
@ -933,11 +933,12 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
if (argc == 0) {
const char *head = "BISECT_HEAD";
enum get_oid_result res_head = get_oid(head, &oid);
enum get_oid_result res_head = repo_get_oid(the_repository,
head, &oid);
if (res_head == MISSING_OBJECT) {
head = "HEAD";
res_head = get_oid(head, &oid);
res_head = repo_get_oid(the_repository, head, &oid);
}
if (res_head)
@ -953,7 +954,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
for (; argc; argc--, argv++) {
struct commit *commit;
if (get_oid(*argv, &oid)){
if (repo_get_oid(the_repository, *argv, &oid)){
error(_("Bad rev input: %s"), *argv);
oid_array_clear(&revs);
return BISECT_FAILED;