diff options
author | Alberto Cortés <alcortesm@gmail.com> | 2016-10-27 20:12:24 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-10-27 18:12:24 +0000 |
commit | 5944d8a185ff1f91e0e108dab1d756fd88692c3b (patch) | |
tree | 06d6fc8f9c8c6a579d518d289ffab8be70ce008d /utils/binary/writer_test.go | |
parent | 0c6c4047155692caff733d0cd239b80508b7bd04 (diff) | |
download | go-git-5944d8a185ff1f91e0e108dab1d756fd88692c3b.tar.gz |
Fix ssh workflow (#96)
* Fix #80
We were sending an additional `\n` to the server when sending the
upload request, see clients/ssh/git_upload_pack.go:174:
fmt.Fprintln(si, r.String())
The reason for this was to flush the input stream, otherwise, the
message was not send to the server.
Also, we were (and still are) not checking remote execution errors, so
we were unaware of this error, reading the first portion of the packfile
as if nothing were wrong.
On the few ocasions when the server was quick enough to fail before
sending the full packfile, one of our tests (the one that checks the
received packfile size) failed.
We were also escaping the repository name in the remote command
execution string incorrectly.
Now we are:
- using ssh.Run to run the remote command, instead of start and wait,
which is the same but simpler.
- using io.Copy instead of fmt.Fprintln, so we avoid adding and extra EOL and also we don't use a line buffered stream.
and we no longer have to flush it.
- we are closing the input stream as soon as possible, so the remote
command can exit also as soon as possible.
- the remote command escape character (') is used correctly
* WIP
* ssh: return remote command exit value when closing the packfile stream
Diffstat (limited to 'utils/binary/writer_test.go')
0 files changed, 0 insertions, 0 deletions