summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--refs.c2
-rw-r--r--refs/files-backend.c3
2 files changed, 1 insertions, 4 deletions
diff --git a/refs.c b/refs.c
index cd9b8bb114..fe373bae4e 100644
--- a/refs.c
+++ b/refs.c
@@ -1713,8 +1713,6 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
if (refs_read_raw_ref(refs, refname, oid, &sb_refname,
&read_flags, failure_errno)) {
*flags |= read_flags;
- if (errno)
- *failure_errno = errno;
/* In reading mode, refs must eventually resolve */
if (resolve_flags & RESOLVE_REF_READING)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index abb6091fcf..4bb4de72b6 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -385,7 +385,6 @@ stat_ref:
if (lstat(path, &st) < 0) {
int ignore_errno;
myerr = errno;
- errno = 0;
if (myerr != ENOENT)
goto out;
if (refs_read_raw_ref(refs->packed_ref_store, refname, oid,
@@ -402,7 +401,6 @@ stat_ref:
strbuf_reset(&sb_contents);
if (strbuf_readlink(&sb_contents, path, st.st_size) < 0) {
myerr = errno;
- errno = 0;
if (myerr == ENOENT || myerr == EINVAL)
/* inconsistent with lstat; retry */
goto stat_ref;
@@ -472,6 +470,7 @@ out:
strbuf_release(&sb_path);
strbuf_release(&sb_contents);
+ errno = 0;
return ret;
}