[PATCH v6? 11/17] refs API: make resolve_gitlink_ref() not set errno
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 11, 2021, 16:30 UTC
- Message-ID
- <patch-11.17-a359d1533bd-20210711T162803Z-avarab@gmail.com>
- In-Reply-To
- <cover-00.17-00000000000-20210711T162803Z-avarab@gmail.com>
I have carefully read the upstream callers of resolve_gitlink_ref() and determined that they don't care about errno. So let's move away from the errno-setting refs_resolve_ref_unsafe() wrapper to refs_resolve_ref_unsafe_with_errno(), and explicitly ignore the errno it sets for us.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- refs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/refs.c b/refs.c index 91320f092fb..7a9cdb1d720 100644 --- a/refs.c +++ b/refs.c @@ -1814,14 +1814,15 @@ int resolve_gitlink_ref(const char *submodule, const char *refname, { struct ref_store *refs; int flags; + int ignore_errno; refs = get_submodule_ref_store(submodule); if (!refs) return -1; - if (!refs_resolve_ref_unsafe(refs, refname, 0, oid, &flags) || - is_null_oid(oid)) + if (!refs_resolve_ref_unsafe_with_errno(refs, refname, 0, oid, &flags, + &ignore_errno) || is_null_oid(oid)) return -1; return 0; }
-- 2.32.0-dev