summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2015-05-01 14:25:55 +0200
committerJunio C Hamano <gitster@pobox.com>2015-05-10 11:31:33 -0700
commit8f3c7e5e255aed34b1891338102b18a829a65ef0 (patch)
treeac40b7ba7fe4e19de57521afacbc5be89ff5ceea
parent2ec85f20a4e069a1d535b9cedd99becbd6d52abb (diff)
downloadgit-8f3c7e5e255aed34b1891338102b18a829a65ef0.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 c2962604aa..0c10bd84b5 100644
--- a/refs.c
+++ b/refs.c
@@ -2891,9 +2891,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);
@@ -2909,9 +2908,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;
}