From: Ronnie Sahlberg <sahlb...@google.com> Change lock_ref_sha1_basic to return an error instead of dying when we fail to lock a file during a transaction. This function is only called from transaction_commit() and it knows how to handle these failures.
Signed-off-by: Ronnie Sahlberg <sahlb...@google.com> Signed-off-by: Jonathan Nieder <jrnie...@gmail.com> Signed-off-by: Stefan Beller <sbel...@google.com> --- refs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index f30512f..78eb46f 100644 --- a/refs.c +++ b/refs.c @@ -2340,6 +2340,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname, lock->lock_fd = hold_lock_file_for_update(lock->lk, ref_file, lflags); if (lock->lock_fd < 0) { + last_errno = errno; if (errno == ENOENT && --attempts_remaining > 0) /* * Maybe somebody just deleted one of the @@ -2347,8 +2348,13 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname, * again: */ goto retry; - else - unable_to_lock_die(ref_file, errno); + else { + struct strbuf err = STRBUF_INIT; + unable_to_lock_message(ref_file, errno, &err); + error("%s", err.buf); + strbuf_reset(&err); + goto error_return; + } } return old_sha1 ? verify_lock(lock, old_sha1, mustexist) : lock; -- 2.2.0.rc2.5.gf7b9fb2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html