aboutsummaryrefslogtreecommitdiffstats
path: root/formats/packfile
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-02-17 00:24:31 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-02-17 11:46:00 +0100
commita964e32d92c53a47ce7c46d589a18c62133b8c50 (patch)
tree4c094cd6afb95cb2832f866b9411276418435819 /formats/packfile
parent1ac00554c3b5f88d2ddc2e28e7cfcdcad9d9f4bb (diff)
downloadgo-git-a964e32d92c53a47ce7c46d589a18c62133b8c50.tar.gz
storages: memory object
Diffstat (limited to 'formats/packfile')
-rw-r--r--formats/packfile/reader.go4
-rw-r--r--formats/packfile/reader_test.go11
2 files changed, 8 insertions, 7 deletions
diff --git a/formats/packfile/reader.go b/formats/packfile/reader.go
index 91aef21..e981d72 100644
--- a/formats/packfile/reader.go
+++ b/formats/packfile/reader.go
@@ -125,7 +125,7 @@ func (r *Reader) readObjects(count uint32) error {
// of which 12-20 % is _not_ zlib inflation (ie. is our code).
for i := 0; i < int(count); i++ {
start := r.r.position
- obj, err := r.newRAWObject()
+ obj, err := r.newObject()
if err != nil && err != io.EOF {
return err
}
@@ -143,7 +143,7 @@ func (r *Reader) readObjects(count uint32) error {
return nil
}
-func (r *Reader) newRAWObject() (core.Object, error) {
+func (r *Reader) newObject() (core.Object, error) {
raw, err := r.s.New()
if err != nil {
return nil, err
diff --git a/formats/packfile/reader_test.go b/formats/packfile/reader_test.go
index f460614..69069c8 100644
--- a/formats/packfile/reader_test.go
+++ b/formats/packfile/reader_test.go
@@ -10,6 +10,7 @@ import (
"time"
"gopkg.in/src-d/go-git.v2/core"
+ "gopkg.in/src-d/go-git.v2/storages/memory"
"github.com/dustin/go-humanize"
. "gopkg.in/check.v1"
@@ -29,7 +30,7 @@ func (s *ReaderSuite) TestReadPackfile(c *C) {
r := NewReader(d)
- storage := core.NewRAWObjectStorage()
+ storage := memory.NewObjectStorage()
_, err := r.Read(storage)
c.Assert(err, IsNil)
@@ -63,7 +64,7 @@ func (s *ReaderSuite) testReadPackfileGitFixture(c *C, file string, f Format) {
r := NewReader(d)
r.Format = f
- storage := core.NewRAWObjectStorage()
+ storage := memory.NewObjectStorage()
_, err = r.Read(storage)
c.Assert(err, IsNil)
@@ -99,7 +100,7 @@ func (s *ReaderSuite) testReadPackfileGitFixture(c *C, file string, f Format) {
})
}
-func AssertObjects(c *C, s *core.RAWObjectStorage, expects []string) {
+func AssertObjects(c *C, s *memory.ObjectStorage, expects []string) {
c.Assert(len(expects), Equals, len(s.Objects))
for _, expected := range expects {
obtained, err := s.Get(core.NewHash(expected))
@@ -174,14 +175,14 @@ func (s *ReaderSuite) _TestMemoryREF(c *C) {
fmt.Println("time", time.Since(start))
}
-func readFromFile(c *C, file string, f Format) *core.RAWObjectStorage {
+func readFromFile(c *C, file string, f Format) *memory.ObjectStorage {
d, err := os.Open(file)
c.Assert(err, IsNil)
r := NewReader(d)
r.Format = f
- storage := core.NewRAWObjectStorage()
+ storage := memory.NewObjectStorage()
_, err = r.Read(storage)
c.Assert(err, IsNil)