summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2015-05-11 17:25:17 +0200
committerJunio C Hamano <gitster@pobox.com>2015-05-11 11:50:20 -0700
commitabeef9c85657fddf98f01c8479f1437719e95864 (patch)
treeea0b0aa09cc6f9d2f8362d60d75479b4b9d90068
parent5b2d8d6f2184381b76c13504a2f5ec8a62cd584e (diff)
downloadgit-abeef9c85657fddf98f01c8479f1437719e95864.tar.gz
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>
-rw-r--r--refs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/refs.c b/refs.c
index ce993bd125..87c1ad161d 100644
--- a/refs.c
+++ b/refs.c
@@ -2907,9 +2907,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);
@@ -2923,9 +2922,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;
}