Skip to content

Commit 31e3912

Browse files
committed
Merge branch 'ab/refs-errno-cleanup'
A brown-paper-bag fix on top of a topic that was merged during this cycle. * ab/refs-errno-cleanup: refs API: use "failure_errno", not "errno"
2 parents 1ffcbaa + cac15b3 commit 31e3912

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

refs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,8 +1722,6 @@ const char *refs_resolve_ref_unsafe(struct ref_store *refs,
17221722
if (refs_read_raw_ref(refs, refname, oid, &sb_refname,
17231723
&read_flags, failure_errno)) {
17241724
*flags |= read_flags;
1725-
if (errno)
1726-
*failure_errno = errno;
17271725

17281726
/* In reading mode, refs must eventually resolve */
17291727
if (resolve_flags & RESOLVE_REF_READING)

refs/files-backend.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ static int files_read_raw_ref(struct ref_store *ref_store, const char *refname,
382382
if (lstat(path, &st) < 0) {
383383
int ignore_errno;
384384
myerr = errno;
385-
errno = 0;
386385
if (myerr != ENOENT)
387386
goto out;
388387
if (refs_read_raw_ref(refs->packed_ref_store, refname, oid,
@@ -399,7 +398,6 @@ static int files_read_raw_ref(struct ref_store *ref_store, const char *refname,
399398
strbuf_reset(&sb_contents);
400399
if (strbuf_readlink(&sb_contents, path, st.st_size) < 0) {
401400
myerr = errno;
402-
errno = 0;
403401
if (myerr == ENOENT || myerr == EINVAL)
404402
/* inconsistent with lstat; retry */
405403
goto stat_ref;
@@ -469,6 +467,7 @@ static int files_read_raw_ref(struct ref_store *ref_store, const char *refname,
469467

470468
strbuf_release(&sb_path);
471469
strbuf_release(&sb_contents);
470+
errno = 0;
472471
return ret;
473472
}
474473

0 commit comments

Comments
 (0)