mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-13 04:26:40 +00:00
ssh: read from stderr if stdout is empty
When we fail to read from stdout, it's typically because the URL was wrong and the server process has sent some output over its stderr output. Read that output and set the error message to whatever we read from it.
This commit is contained in:
parent
acc573cba3
commit
e3435673b8
@ -45,6 +45,10 @@ support for HTTPS connections insead of OpenSSL.
|
||||
* The index now uses diffs for `add_all()` and `update_all()` which
|
||||
gives it a speed boost and closer semantics to git.
|
||||
|
||||
* The ssh transport now reports the stderr output from the server as
|
||||
the error message, which allows you to get the "repository not
|
||||
found" messages.
|
||||
|
||||
|
||||
### API additions
|
||||
|
||||
|
@ -125,10 +125,17 @@ static int ssh_stream_read(
|
||||
return -1;
|
||||
|
||||
if ((rc = libssh2_channel_read(s->channel, buffer, buf_size)) < LIBSSH2_ERROR_NONE) {
|
||||
ssh_error(s->session, "SSH could not read data");;
|
||||
ssh_error(s->session, "SSH could not read data");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Having something in stderr is typically a not-found error */
|
||||
if (rc == 0 && (rc = libssh2_channel_read_stderr(s->channel, buffer, buf_size)) > 0) {
|
||||
giterr_set(GITERR_SSH, "%*s", rc, buffer);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
*bytes_read = rc;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user