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

@ -25,7 +25,8 @@
static const char *short_commit_name(struct commit *commit)
{
return find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV);
return repo_find_unique_abbrev(the_repository, &commit->object.oid,
DEFAULT_ABBREV);
}
static struct commit *peel_committish(const char *name)
@ -33,10 +34,11 @@ static struct commit *peel_committish(const char *name)
struct object *obj;
struct object_id oid;
if (get_oid(name, &oid))
if (repo_get_oid(the_repository, name, &oid))
return NULL;
obj = parse_object(the_repository, &oid);
return (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
return (struct commit *)repo_peel_to_type(the_repository, name, 0, obj,
OBJ_COMMIT);
}
static char *get_author(const char *message)
@ -119,7 +121,7 @@ int cmd__fast_rebase(int argc, const char **argv)
strbuf_addf(&branch_name, "refs/heads/%s", argv[4]);
/* Sanity check */
if (get_oid("HEAD", &head))
if (repo_get_oid(the_repository, "HEAD", &head))
die(_("Cannot read HEAD"));
assert(oideq(&onto->object.oid, &head));

View File

@ -9,9 +9,9 @@ int cmd__match_trees(int ac, const char **av)
setup_git_directory();
if (get_oid(av[1], &hash1))
if (repo_get_oid(the_repository, av[1], &hash1))
die("cannot parse %s as an object name", av[1]);
if (get_oid(av[2], &hash2))
if (repo_get_oid(the_repository, av[2], &hash2))
die("cannot parse %s as an object name", av[2]);
one = parse_tree_indirect(&hash1);
if (!one)

View File

@ -49,7 +49,7 @@ int cmd__oidmap(int argc, const char **argv)
if (!strcmp("put", cmd) && p1 && p2) {
if (get_oid(p1, &oid)) {
if (repo_get_oid(the_repository, p1, &oid)) {
printf("Unknown oid: %s\n", p1);
continue;
}
@ -67,7 +67,7 @@ int cmd__oidmap(int argc, const char **argv)
} else if (!strcmp("get", cmd) && p1) {
if (get_oid(p1, &oid)) {
if (repo_get_oid(the_repository, p1, &oid)) {
printf("Unknown oid: %s\n", p1);
continue;
}
@ -80,7 +80,7 @@ int cmd__oidmap(int argc, const char **argv)
} else if (!strcmp("remove", cmd) && p1) {
if (get_oid(p1, &oid)) {
if (repo_get_oid(the_repository, p1, &oid)) {
printf("Unknown oid: %s\n", p1);
continue;
}

View File

@ -57,7 +57,7 @@ int cmd__reach(int ac, const char **av)
if (buf.len < 3)
continue;
if (get_oid_committish(buf.buf + 2, &oid))
if (repo_get_oid_committish(the_repository, buf.buf + 2, &oid))
die("failed to resolve %s", buf.buf + 2);
orig = parse_object(r, &oid);

View File

@ -42,7 +42,7 @@ int cmd__submodule_config(int argc, const char **argv)
if (commit[0] == '\0')
oidclr(&commit_oid);
else if (get_oid(commit, &commit_oid) < 0)
else if (repo_get_oid(the_repository, commit, &commit_oid) < 0)
die_usage(argc, argv, "Commit not found.");
if (lookup_name) {