Thread (135 messages) flat view 135 messages, 4 authors, 2021-08-23
STALE1852d

[PATCH v6? 08/17] refs file-backend.c: stop setting "EBUSY" in verify_lock()

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-07-11 16:31:01
Subsystem: the rest · Maintainer: Linus Torvalds

This EBUSY was set in 835e3c992fd (refs.c: verify_lock should set
errno to something meaningful, 2014-06-20) to fix a bug in code that
was later refactored in cd94f765720 (fetch.c: change s_update_ref to
use a ref transaction, 2014-04-28) to not use errno at all, the two
were a part of the same series.

So this was only ever needed for an intra-series bugfix, and we kept
it around for no reason. Removing it makes subsequent commits where we
refactor code surrounding verify_lock() (which may use errno) easier
to reason about.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 refs/files-backend.c | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index a4e9344ac8b..abed0572fea 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -880,9 +880,7 @@ static int verify_lock(struct ref_store *ref_store, struct ref_lock *lock,
 			       mustexist ? RESOLVE_REF_READING : 0,
 			       &lock->old_oid, NULL)) {
 		if (old_oid) {
-			int save_errno = errno;
 			strbuf_addf(err, "can't verify ref '%s'", lock->ref_name);
-			errno = save_errno;
 			return -1;
 		} else {
 			oidclr(&lock->old_oid);
@@ -894,7 +892,6 @@ static int verify_lock(struct ref_store *ref_store, struct ref_lock *lock,
 			    lock->ref_name,
 			    oid_to_hex(&lock->old_oid),
 			    oid_to_hex(old_oid));
-		errno = EBUSY;
 		return -1;
 	}
 	return 0;
-- 
2.32.0-dev
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help