Commit 8b7495fc by Edward Thomson

push: set generic error in push_negotiation cb

When a user returns `-1` in a `push_negotiation` callback, we set the
error to whatever's hanging out in the buffer, probably something about
a missing configuration entry.

Clear the error buffer before invoking the callback, so that if a user
does not set an error message in their callback that we can detect. If
there is no error but `-1` is returned, set a generic error message.
parent 45fd9ed7
......@@ -444,10 +444,21 @@ static int do_push(git_push *push)
if ((error = calculate_work(push)) < 0)
goto on_error;
if (callbacks && callbacks->push_negotiation &&
(error = callbacks->push_negotiation((const git_push_update **) push->updates.contents,
push->updates.length, callbacks->payload)) < 0)
goto on_error;
if (callbacks && callbacks->push_negotiation) {
git_error_clear();
error = callbacks->push_negotiation(
(const git_push_update **) push->updates.contents,
push->updates.length, callbacks->payload);
if (error < 0) {
git_error_set_after_callback_function(error,
"push_negotiation");
goto on_error;
}
error = 0;
}
if ((error = queue_objects(push)) < 0 ||
(error = transport->push(transport, push)) < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment