In the preceding commit we moved away from refs_resolve_ref_unsafe() in this function and started using a "resolve_errno" variable, which means that if this refs_resolve_ref_unsafe() invocation sets "errno" we'd end up ignoring it for our earlier "resolve_errno" (if any). I'm not sure if this is what we should be doing, but let's add a BUG() here for now to indicate that we hit a case we'd previously "handle", but which we now ignore. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> --- refs/files-backend.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index d6ee7c1172f..a4e9344ac8b 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -953,6 +953,7 @@ static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs, &lock->old_oid, type, &resolve_errno); if (!resolved && resolve_errno == EISDIR) { + int ignore_errno = 0; /* * we are trying to lock foo but we used to * have foo/bar which now does not exist; @@ -967,9 +968,15 @@ static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs, refname); goto error_return; } - resolved = !!refs_resolve_ref_unsafe(&refs->base, - refname, resolve_flags, - &lock->old_oid, type); + resolved = !!refs_resolve_ref_unsafe_with_errno(&refs->base, + refname, resolve_flags, + &lock->old_oid, type, + &ignore_errno); + if (ignore_errno) + BUG("hit errno %d (%s) that will be ignored, " + "resolve errno is %d (%s)", + ignore_errno, strerror(ignore_errno), + resolve_errno, strerror(resolve_errno)); } if (!resolved && (resolve_errno != ENOTDIR || -- 2.32.0-dev