зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
abeef9c856
Коммит
cbaabcbc6f
10
refs.c
10
refs.c
|
@ -3838,13 +3838,15 @@ int ref_transaction_commit(struct ref_transaction *transaction,
|
||||||
&update->type,
|
&update->type,
|
||||||
err);
|
err);
|
||||||
if (!update->lock) {
|
if (!update->lock) {
|
||||||
|
char *reason;
|
||||||
|
|
||||||
ret = (errno == ENOTDIR)
|
ret = (errno == ENOTDIR)
|
||||||
? TRANSACTION_NAME_CONFLICT
|
? TRANSACTION_NAME_CONFLICT
|
||||||
: TRANSACTION_GENERIC_ERROR;
|
: TRANSACTION_GENERIC_ERROR;
|
||||||
error("%s", err->buf);
|
reason = strbuf_detach(err, NULL);
|
||||||
strbuf_reset(err);
|
strbuf_addf(err, "Cannot lock the ref '%s': %s",
|
||||||
strbuf_addf(err, "Cannot lock the ref '%s'.",
|
update->refname, reason);
|
||||||
update->refname);
|
free(reason);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче