Return io.EOF on OdbReadStream.Read()

This change makes OdbReadStream.Read() comply with the usual io.Reader
semantics.
This commit is contained in:
lhchavez 2018-12-28 04:29:20 +00:00
parent 8b368063e9
commit 344dc33fae
1 changed files with 4 additions and 0 deletions

4
odb.go
View File

@ -8,6 +8,7 @@ extern void _go_git_odb_backend_free(git_odb_backend *backend);
*/
import "C"
import (
"io"
"reflect"
"runtime"
"unsafe"
@ -287,6 +288,9 @@ func (stream *OdbReadStream) Read(data []byte) (int, error) {
if ret < 0 {
return 0, MakeGitError(ret)
}
if ret == 0 {
return 0, io.EOF
}
header.Len = int(ret)