Skip to content

Commit 48cdcd9

Browse files
avargitster
authored andcommitted
refs/files: remove unused "errno != ENOTDIR" condition
As a follow-up to the preceding commit where we removed the adjacent "errno == EISDIR" condition in the same function, remove the "last_errno != ENOTDIR" condition here. It's not possible for us to hit this condition added in 5b2d8d6 (lock_ref_sha1_basic(): improve diagnostics for ref D/F conflicts, 2015-05-11). Since a1c1d81 (refs_resolve_ref_unsafe: handle d/f conflicts for writes, 2017-10-06) we've explicitly caught these in refs_resolve_ref_unsafe() before returning NULL: if (errno != ENOENT && errno != EISDIR && errno != ENOTDIR) return NULL; We'd then always return the refname from refs_resolve_ref_unsafe() even if we were in a broken state as explained in the preceding commit. The elided context here is a call to refs_resolve_ref_unsafe(). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 245fbba commit 48cdcd9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

refs/files-backend.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,7 @@ static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,
893893
RESOLVE_REF_NO_RECURSE,
894894
&lock->old_oid, type)) {
895895
last_errno = errno;
896-
if (last_errno != ENOTDIR ||
897-
!refs_verify_refname_available(&refs->base, refname,
896+
if (!refs_verify_refname_available(&refs->base, refname,
898897
NULL, NULL, err))
899898
strbuf_addf(err, "unable to resolve reference '%s': %s",
900899
refname, strerror(last_errno));

0 commit comments

Comments
 (0)