From: Michael Haggerty Date: Fri, 01 May 2015 12:25:55 GMT Subject: [PATCH 15/18] rename_ref(): integrate lock_ref_sha1_basic() errors into ours Message-ID: <1430483158-14349-16-git-send-email-mhagger@alum.mit.edu> In-Reply-To: <1430483158-14349-1-git-send-email-mhagger@alum.mit.edu> 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 --- refs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/refs.c b/refs.c index cdbd31a..6077e83 100644 --- a/refs.c +++ b/refs.c @@ -2889,9 +2889,8 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms lock = lock_ref_sha1_basic(newrefname, NULL, NULL, NULL, 0, NULL, &err); if (!lock) { - error("%s", err.buf); + error("unable to rename '%s' to '%s': %s", oldrefname, newrefname, err.buf); strbuf_release(&err); - error("unable to lock %s for update", newrefname); goto rollback; } hashcpy(lock->old_sha1, orig_sha1); @@ -2906,9 +2905,8 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms rollback: lock = lock_ref_sha1_basic(oldrefname, NULL, NULL, NULL, 0, NULL, &err); if (!lock) { - error("%s", err.buf); + error("unable to lock %s for rollback: %s", oldrefname, err.buf); strbuf_release(&err); - error("unable to lock %s for rollback", oldrefname); goto rollbacklog; } -- 2.1.4