summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-12-22 20:26:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-12-22 20:26:27 (GMT)
commit3cdb0cb610121731c510088ecbc21959fa1e27e3 (patch)
tree3a9cd757544a8babe29f02bb76d3d969524fd468
parent0ed8a4e161c06b82734f5f5268a5b1fb68abb954 (diff)
parent068395150b8a2b3e6fbed3e60ca5cbb7c7bb6a99 (diff)
downloadgit-3cdb0cb610121731c510088ecbc21959fa1e27e3.zip
git-3cdb0cb610121731c510088ecbc21959fa1e27e3.tar.gz
git-3cdb0cb610121731c510088ecbc21959fa1e27e3.tar.bz2
Merge branch 'jk/lock-ref-sha1-basic-return-errors'
Correct an API anomaly. * jk/lock-ref-sha1-basic-return-errors: lock_ref_sha1_basic: do not die on locking errors
-rw-r--r--refs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index 5ff457e..0347328 100644
--- a/refs.c
+++ b/refs.c
@@ -2318,6 +2318,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
@@ -2325,8 +2326,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;