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

[PATCH v6? 09/17] refs file-backend.c: deal with errno directly in verify_lock()

STALE1868d

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

Instead of using the refs_read_ref_full() wrapper function let's use
the refs_resolve_ref_unsafe_with_errno() function it resolves to (note
the inverted return values).

Per a preceding change to remove an "errno" assignment from
verify_lock() we can explicitly ignore errno here, we use the strbuf
"err" API instead.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 refs/files-backend.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index abed0572fea..e3d27001b86 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -874,11 +874,12 @@ static int verify_lock(struct ref_store *ref_store, struct ref_lock *lock,
 		       const struct object_id *old_oid, int mustexist,
 		       struct strbuf *err)
 {
+	int ignore_errno;
 	assert(err);
 
-	if (refs_read_ref_full(ref_store, lock->ref_name,
-			       mustexist ? RESOLVE_REF_READING : 0,
-			       &lock->old_oid, NULL)) {
+	if (!refs_resolve_ref_unsafe_with_errno(ref_store, lock->ref_name,
+						mustexist ? RESOLVE_REF_READING : 0,
+						&lock->old_oid, NULL, &ignore_errno)) {
 		if (old_oid) {
 			strbuf_addf(err, "can't verify ref '%s'", lock->ref_name);
 			return -1;
-- 
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