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 <mhag...@alum.mit.edu>
---
 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

--
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

Reply via email to