rename_ref(): integrate lock_ref_sha1_basic() errors into ours

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>

Michael Haggerty committed May 11, 2015 at 17:25 UTC abeef9c85657fddf98f01c8479f1437719e95864
1 file changed +2 -4
refs.c
+2 -4
@@ -2907,9 +2907,8 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
2907
2908 lock = lock_ref_sha1_basic(newrefname, NULL, NULL, NULL, 0, NULL, &err);
2909 if (!lock) {
2910 - error("%s", err.buf);
2910 + error("unable to rename '%s' to '%s': %s", oldrefname, newrefname, err.buf);
2911 strbuf_release(&err);
2912 - error("unable to lock %s for update", newrefname);
2912 goto rollback;
2913 }
2914 hashcpy(lock->old_sha1, orig_sha1);
@@ -2923,9 +2922,8 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
2922 rollback:
2923 lock = lock_ref_sha1_basic(oldrefname, NULL, NULL, NULL, 0, NULL, &err);
2924 if (!lock) {
2926 - error("%s", err.buf);
2925 + error("unable to lock %s for rollback: %s", oldrefname, err.buf);
2926 strbuf_release(&err);
2928 - error("unable to lock %s for rollback", oldrefname);
2927 goto rollbacklog;
2928 }
2929