refs API: make refs_ref_exists() not set errno

Move refs_ref_exists from the legacy refs_resolve_ref_unsafe() to the
new refs_werrres_ref_unsafe(). I have read its callers and determined
that they don't care about errno being set, in particular:

    git grep -W -w -e refs_ref_exists -e ref_exists

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 2021-10-16 11:39:22 +02:00 committed by Junio C Hamano
parent f65bb9fb06
commit 1e3ccb552f

4
refs.c
View File

@ -309,7 +309,9 @@ int read_ref(const char *refname, struct object_id *oid)
int refs_ref_exists(struct ref_store *refs, const char *refname)
{
return !!refs_resolve_ref_unsafe(refs, refname, RESOLVE_REF_READING, NULL, NULL);
int ignore_errno;
return !!refs_werrres_ref_unsafe(refs, refname, RESOLVE_REF_READING,
NULL, NULL, &ignore_errno);
}
int ref_exists(const char *refname)