Return io.EOF on OdbReadStream.Read()
This change makes OdbReadStream.Read() comply with the usual io.Reader semantics.
This commit is contained in:
parent
8b368063e9
commit
344dc33fae
4
odb.go
4
odb.go
|
@ -8,6 +8,7 @@ extern void _go_git_odb_backend_free(git_odb_backend *backend);
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
@ -287,6 +288,9 @@ func (stream *OdbReadStream) Read(data []byte) (int, error) {
|
||||||
if ret < 0 {
|
if ret < 0 {
|
||||||
return 0, MakeGitError(ret)
|
return 0, MakeGitError(ret)
|
||||||
}
|
}
|
||||||
|
if ret == 0 {
|
||||||
|
return 0, io.EOF
|
||||||
|
}
|
||||||
|
|
||||||
header.Len = int(ret)
|
header.Len = int(ret)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue