]> granicus.if.org Git - git/commitdiff
reflog_expire(): integrate lock_ref_sha1_basic() errors into ours
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 11 May 2015 15:25:20 +0000 (17:25 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 May 2015 18:50:20 +0000 (11:50 -0700)
Now that lock_ref_sha1_basic() gives us back its error messages via a
strbuf, incorporate its error message into our error message rather
than emitting two separate error messages.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
refs.c

diff --git a/refs.c b/refs.c
index bc4b1ab8b71b2d2e740426494a5b6fababb84bd0..97043fd2ef88fd50dadf05d673bb80018d3caf06 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -4118,9 +4118,9 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
         */
        lock = lock_ref_sha1_basic(refname, sha1, NULL, NULL, 0, &type, &err);
        if (!lock) {
-               error("%s", err.buf);
+               error("cannot lock ref '%s': %s", refname, err.buf);
                strbuf_release(&err);
-               return error("cannot lock ref '%s'", refname);
+               return -1;
        }
        if (!reflog_exists(refname)) {
                unlock_ref(lock);