aboutsummaryrefslogtreecommitdiffstats
path: root/formats/packfile/reader.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2015-10-26 01:22:54 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2015-10-26 01:22:54 +0100
commit688e802814f791a8723874dc88437bd8d140e103 (patch)
treeaeaf5e435e5802d9c8ae855a88128a49bc9768c8 /formats/packfile/reader.go
parent9a44cd8ccff143a112436c38bfe5581e74b68f07 (diff)
downloadgo-git-688e802814f791a8723874dc88437bd8d140e103.tar.gz
objects: using readers from internal.Object
Diffstat (limited to 'formats/packfile/reader.go')
-rw-r--r--formats/packfile/reader.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/formats/packfile/reader.go b/formats/packfile/reader.go
index 6ccf384..420b9cd 100644
--- a/formats/packfile/reader.go
+++ b/formats/packfile/reader.go
@@ -7,7 +7,7 @@ import (
"io"
"io/ioutil"
- "gopkg.in/src-d/go-git.v2/common"
+ "gopkg.in/src-d/go-git.v2/internal"
"github.com/klauspost/compress/zlib"
)
@@ -50,8 +50,8 @@ type Reader struct {
Format Format
r *trackingReader
- s common.ObjectStorage
- offsets map[int64]common.Hash
+ s internal.ObjectStorage
+ offsets map[int64]internal.Hash
}
// NewReader returns a new Reader that reads from a io.Reader
@@ -60,12 +60,12 @@ func NewReader(r io.Reader) *Reader {
MaxObjectsLimit: DefaultMaxObjectsLimit,
r: &trackingReader{r: r},
- offsets: make(map[int64]common.Hash, 0),
+ offsets: make(map[int64]internal.Hash, 0),
}
}
// Read reads the objects and stores it at the ObjectStorage
-func (r *Reader) Read(s common.ObjectStorage) (int64, error) {
+func (r *Reader) Read(s internal.ObjectStorage) (int64, error) {
r.s = s
if err := r.validateHeader(); err != nil {
if err == io.EOF {
@@ -144,7 +144,7 @@ func (r *Reader) readObjects(count uint32) error {
return nil
}
-func (r *Reader) newRAWObject() (common.Object, error) {
+func (r *Reader) newRAWObject() (internal.Object, error) {
raw := r.s.New()
var steps int64
@@ -153,7 +153,7 @@ func (r *Reader) newRAWObject() (common.Object, error) {
return nil, err
}
- typ := common.ObjectType((buf[0] >> 4) & 7)
+ typ := internal.ObjectType((buf[0] >> 4) & 7)
size := int64(buf[0] & 15)
steps++ // byte we just read to get `o.typ` and `o.size`
@@ -173,11 +173,11 @@ func (r *Reader) newRAWObject() (common.Object, error) {
var err error
switch raw.Type() {
- case common.REFDeltaObject:
+ case internal.REFDeltaObject:
err = r.readREFDelta(raw)
- case common.OFSDeltaObject:
+ case internal.OFSDeltaObject:
err = r.readOFSDelta(raw, steps)
- case common.CommitObject, common.TreeObject, common.BlobObject, common.TagObject:
+ case internal.CommitObject, internal.TreeObject, internal.BlobObject, internal.TagObject:
err = r.readObject(raw)
default:
err = InvalidObjectErr.n("tag %q", raw.Type)
@@ -186,8 +186,8 @@ func (r *Reader) newRAWObject() (common.Object, error) {
return raw, err
}
-func (r *Reader) readREFDelta(raw common.Object) error {
- var ref common.Hash
+func (r *Reader) readREFDelta(raw internal.Object) error {
+ var ref internal.Hash
if _, err := r.r.Read(ref[:]); err != nil {
return err
}
@@ -215,7 +215,7 @@ func (r *Reader) readREFDelta(raw common.Object) error {
return nil
}
-func (r *Reader) readOFSDelta(raw common.Object, steps int64) error {
+func (r *Reader) readOFSDelta(raw internal.Object, steps int64) error {
start := r.r.position
offset, err := decodeOffset(r.r, steps)
if err != nil {
@@ -246,7 +246,7 @@ func (r *Reader) readOFSDelta(raw common.Object, steps int64) error {
return nil
}
-func (r *Reader) readObject(raw common.Object) error {
+func (r *Reader) readObject(raw internal.Object) error {
return r.inflate(raw.Writer())
}