diff options
author | Alberto Cortés <alberto@sourced.tech> | 2016-01-27 11:13:49 +0100 |
---|---|---|
committer | Alberto Cortés <alberto@sourced.tech> | 2016-01-27 11:55:26 +0100 |
commit | 4c897413b26c18c3a24c667b1bddaaffda7e098e (patch) | |
tree | d1d7f66e22b60cb1e3654cec11d417742d3659e4 /formats/packfile/reader.go | |
parent | f39e08f31be9df1620b751e93ed84c87de2b4e86 (diff) | |
download | go-git-4c897413b26c18c3a24c667b1bddaaffda7e098e.tar.gz |
fix zlib invalid header error
The return value of reads to the packfile were being ignored, so zlib
was getting invalid data on it read buffers.
Diffstat (limited to 'formats/packfile/reader.go')
-rw-r--r-- | formats/packfile/reader.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/formats/packfile/reader.go b/formats/packfile/reader.go index 37918b1..959e411 100644 --- a/formats/packfile/reader.go +++ b/formats/packfile/reader.go @@ -98,7 +98,7 @@ func (r *Reader) Read(s core.ObjectStorage) (int64, error) { func (r *Reader) validateHeader() error { var header = make([]byte, 4) - if _, err := r.r.Read(header); err != nil { + if _, err := io.ReadFull(r.r, header); err != nil { return err } @@ -127,7 +127,6 @@ func (r *Reader) readObjects(count uint32) error { start := r.r.position obj, err := r.newRAWObject() if err != nil && err != io.EOF { - fmt.Println(err) return err } @@ -188,7 +187,7 @@ func (r *Reader) newRAWObject() (core.Object, error) { func (r *Reader) readREFDelta(raw core.Object) error { var ref core.Hash - if _, err := r.r.Read(ref[:]); err != nil { + if _, err := io.ReadFull(r.r, ref[:]); err != nil { return err } |