diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2015-05-11 17:25:18 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-11 11:50:20 -0700 |
commit | cbaabcbc6fa9568269d6baeccb0a621cd0413c6c (patch) | |
tree | ac243b892e65195db44f37113020192e6dfd625a /refs.c | |
parent | abeef9c85657fddf98f01c8479f1437719e95864 (diff) | |
download | git-cbaabcbc6fa9568269d6baeccb0a621cd0413c6c.tar.gz git-cbaabcbc6fa9568269d6baeccb0a621cd0413c6c.tar.xz |
ref_transaction_commit(): provide better error messages
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 one error messages to stderr immediately and returning a
second to our caller.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -3838,13 +3838,15 @@ int ref_transaction_commit(struct ref_transaction *transaction, &update->type, err); if (!update->lock) { + char *reason; + ret = (errno == ENOTDIR) ? TRANSACTION_NAME_CONFLICT : TRANSACTION_GENERIC_ERROR; - error("%s", err->buf); - strbuf_reset(err); - strbuf_addf(err, "Cannot lock the ref '%s'.", - update->refname); + reason = strbuf_detach(err, NULL); + strbuf_addf(err, "Cannot lock the ref '%s': %s", + update->refname, reason); + free(reason); goto cleanup; } } |