The caller already knows how to do it, so always do it in the same
place.
Signed-off-by: Michael Haggerty <[email protected]>
---
refs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 4432bc9..100a767 100644
--- a/refs.c
+++ b/refs.c
@@ -2209,14 +2209,12 @@ static int verify_lock(struct ref_lock *lock,
lock->old_sha1, NULL)) {
int save_errno = errno;
error("Can't verify ref %s", lock->ref_name);
- unlock_ref(lock);
errno = save_errno;
return -1;
}
if (hashcmp(lock->old_sha1, old_sha1)) {
error("Ref %s is at %s but expected %s", lock->ref_name,
sha1_to_hex(lock->old_sha1), sha1_to_hex(old_sha1));
- unlock_ref(lock);
errno = EBUSY;
return -1;
}
@@ -2450,8 +2448,10 @@ static struct ref_lock *lock_ref_sha1_basic(const char
*refname,
goto error_return;
}
}
- if (old_sha1 && verify_lock(lock, old_sha1, mustexist))
- return NULL;
+ if (old_sha1 && verify_lock(lock, old_sha1, mustexist)) {
+ last_errno = errno;
+ goto error_return;
+ }
return lock;
error_return:
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html