diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-11-08 23:46:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-08 23:46:38 +0100 |
commit | ac095bb12c4d29722b60ba9f20590fa7cfa6bc7d (patch) | |
tree | 223f36f336ba3414b1e45cac8af6c4744a5d7ef6 /storage | |
parent | e523701393598f4fa241dd407af9ff8925507a1a (diff) | |
download | go-git-ac095bb12c4d29722b60ba9f20590fa7cfa6bc7d.tar.gz |
new plumbing package (#118)
* plumbing: now core was renamed to core, and formats and clients moved inside
Diffstat (limited to 'storage')
-rw-r--r-- | storage/filesystem/config.go | 2 | ||||
-rw-r--r-- | storage/filesystem/internal/dotgit/dotgit.go | 50 | ||||
-rw-r--r-- | storage/filesystem/internal/dotgit/dotgit_test.go | 26 | ||||
-rw-r--r-- | storage/filesystem/internal/dotgit/writers.go | 12 | ||||
-rw-r--r-- | storage/filesystem/object.go | 97 | ||||
-rw-r--r-- | storage/filesystem/object_test.go | 24 | ||||
-rw-r--r-- | storage/filesystem/reference.go | 11 | ||||
-rw-r--r-- | storage/memory/storage.go | 93 | ||||
-rw-r--r-- | storage/test/storage_suite.go | 113 |
9 files changed, 216 insertions, 212 deletions
diff --git a/storage/filesystem/config.go b/storage/filesystem/config.go index 4b47937..510f51c 100644 --- a/storage/filesystem/config.go +++ b/storage/filesystem/config.go @@ -4,7 +4,7 @@ import ( "os" "gopkg.in/src-d/go-git.v4/config" - gitconfig "gopkg.in/src-d/go-git.v4/formats/config" + gitconfig "gopkg.in/src-d/go-git.v4/plumbing/format/config" "gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit" ) diff --git a/storage/filesystem/internal/dotgit/dotgit.go b/storage/filesystem/internal/dotgit/dotgit.go index 6606153..3a6227e 100644 --- a/storage/filesystem/internal/dotgit/dotgit.go +++ b/storage/filesystem/internal/dotgit/dotgit.go @@ -9,7 +9,7 @@ import ( "os" "strings" - "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/utils/fs" ) @@ -76,7 +76,7 @@ func (d *DotGit) NewObjectPack() (*PackWriter, error) { } // ObjectPacks returns the list of availables packfiles -func (d *DotGit) ObjectPacks() ([]core.Hash, error) { +func (d *DotGit) ObjectPacks() ([]plumbing.Hash, error) { packDir := d.fs.Join(objectsPath, packPath) files, err := d.fs.ReadDir(packDir) if err != nil { @@ -87,14 +87,14 @@ func (d *DotGit) ObjectPacks() ([]core.Hash, error) { return nil, err } - var packs []core.Hash + var packs []plumbing.Hash for _, f := range files { if !strings.HasSuffix(f.Name(), packExt) { continue } n := f.Name() - h := core.NewHash(n[5 : len(n)-5]) //pack-(hash).pack + h := plumbing.NewHash(n[5 : len(n)-5]) //pack-(hash).pack packs = append(packs, h) } @@ -103,7 +103,7 @@ func (d *DotGit) ObjectPacks() ([]core.Hash, error) { } // ObjectPack returns a fs.File of the given packfile -func (d *DotGit) ObjectPack(hash core.Hash) (fs.File, error) { +func (d *DotGit) ObjectPack(hash plumbing.Hash) (fs.File, error) { file := d.fs.Join(objectsPath, packPath, fmt.Sprintf("pack-%s.pack", hash.String())) pack, err := d.fs.Open(file) @@ -119,7 +119,7 @@ func (d *DotGit) ObjectPack(hash core.Hash) (fs.File, error) { } // ObjectPackIdx returns a fs.File of the index file for a given packfile -func (d *DotGit) ObjectPackIdx(hash core.Hash) (fs.File, error) { +func (d *DotGit) ObjectPackIdx(hash plumbing.Hash) (fs.File, error) { file := d.fs.Join(objectsPath, packPath, fmt.Sprintf("pack-%s.idx", hash.String())) idx, err := d.fs.Open(file) if err != nil { @@ -140,7 +140,7 @@ func (d *DotGit) NewObject() (*ObjectWriter, error) { // Objects returns a slice with the hashes of objects found under the // .git/objects/ directory. -func (d *DotGit) Objects() ([]core.Hash, error) { +func (d *DotGit) Objects() ([]plumbing.Hash, error) { files, err := d.fs.ReadDir(objectsPath) if err != nil { if os.IsNotExist(err) { @@ -150,7 +150,7 @@ func (d *DotGit) Objects() ([]core.Hash, error) { return nil, err } - var objects []core.Hash + var objects []plumbing.Hash for _, f := range files { if f.IsDir() && len(f.Name()) == 2 && isHex(f.Name()) { base := f.Name() @@ -160,7 +160,7 @@ func (d *DotGit) Objects() ([]core.Hash, error) { } for _, o := range d { - objects = append(objects, core.NewHash(base+o.Name())) + objects = append(objects, plumbing.NewHash(base+o.Name())) } } } @@ -169,19 +169,19 @@ func (d *DotGit) Objects() ([]core.Hash, error) { } // Object return a fs.File poiting the object file, if exists -func (d *DotGit) Object(h core.Hash) (fs.File, error) { +func (d *DotGit) Object(h plumbing.Hash) (fs.File, error) { hash := h.String() file := d.fs.Join(objectsPath, hash[0:2], hash[2:40]) return d.fs.Open(file) } -func (d *DotGit) SetRef(r *core.Reference) error { +func (d *DotGit) SetRef(r *plumbing.Reference) error { var content string switch r.Type() { - case core.SymbolicReference: + case plumbing.SymbolicReference: content = fmt.Sprintf("ref: %s\n", r.Target()) - case core.HashReference: + case plumbing.HashReference: content = fmt.Sprintln(r.Hash().String()) } @@ -198,8 +198,8 @@ func (d *DotGit) SetRef(r *core.Reference) error { // Refs scans the git directory collecting references, which it returns. // Symbolic references are resolved and included in the output. -func (d *DotGit) Refs() ([]*core.Reference, error) { - var refs []*core.Reference +func (d *DotGit) Refs() ([]*plumbing.Reference, error) { + var refs []*plumbing.Reference if err := d.addRefsFromPackedRefs(&refs); err != nil { return nil, err } @@ -216,7 +216,7 @@ func (d *DotGit) Refs() ([]*core.Reference, error) { } // Ref returns the reference for a given reference name. -func (d *DotGit) Ref(name core.ReferenceName) (*core.Reference, error) { +func (d *DotGit) Ref(name plumbing.ReferenceName) (*plumbing.Reference, error) { ref, err := d.readReferenceFile(".", name.String()) if err == nil { return ref, nil @@ -233,10 +233,10 @@ func (d *DotGit) Ref(name core.ReferenceName) (*core.Reference, error) { } } - return nil, core.ErrReferenceNotFound + return nil, plumbing.ErrReferenceNotFound } -func (d *DotGit) addRefsFromPackedRefs(refs *[]*core.Reference) (err error) { +func (d *DotGit) addRefsFromPackedRefs(refs *[]*plumbing.Reference) (err error) { f, err := d.fs.Open(packedRefsPath) if err != nil { if os.IsNotExist(err) { @@ -267,7 +267,7 @@ func (d *DotGit) addRefsFromPackedRefs(refs *[]*core.Reference) (err error) { } // process lines from a packed-refs file -func (d *DotGit) processLine(line string) (*core.Reference, error) { +func (d *DotGit) processLine(line string) (*plumbing.Reference, error) { switch line[0] { case '#': // comment - ignore return nil, nil @@ -279,15 +279,15 @@ func (d *DotGit) processLine(line string) (*core.Reference, error) { return nil, ErrPackedRefsBadFormat } - return core.NewReferenceFromStrings(ws[1], ws[0]), nil + return plumbing.NewReferenceFromStrings(ws[1], ws[0]), nil } } -func (d *DotGit) addRefsFromRefDir(refs *[]*core.Reference) error { +func (d *DotGit) addRefsFromRefDir(refs *[]*plumbing.Reference) error { return d.walkReferencesTree(refs, refsPath) } -func (d *DotGit) walkReferencesTree(refs *[]*core.Reference, relPath string) error { +func (d *DotGit) walkReferencesTree(refs *[]*plumbing.Reference, relPath string) error { files, err := d.fs.ReadDir(relPath) if err != nil { if os.IsNotExist(err) { @@ -320,7 +320,7 @@ func (d *DotGit) walkReferencesTree(refs *[]*core.Reference, relPath string) err return nil } -func (d *DotGit) addRefFromHEAD(refs *[]*core.Reference) error { +func (d *DotGit) addRefFromHEAD(refs *[]*plumbing.Reference) error { ref, err := d.readReferenceFile(".", "HEAD") if err != nil { if os.IsNotExist(err) { @@ -334,7 +334,7 @@ func (d *DotGit) addRefFromHEAD(refs *[]*core.Reference) error { return nil } -func (d *DotGit) readReferenceFile(refsPath, refFile string) (ref *core.Reference, err error) { +func (d *DotGit) readReferenceFile(refsPath, refFile string) (ref *plumbing.Reference, err error) { path := d.fs.Join(refsPath, refFile) f, err := d.fs.Open(path) @@ -354,7 +354,7 @@ func (d *DotGit) readReferenceFile(refsPath, refFile string) (ref *core.Referenc } line := strings.TrimSpace(string(b)) - return core.NewReferenceFromStrings(refFile, line), nil + return plumbing.NewReferenceFromStrings(refFile, line), nil } func isHex(s string) bool { diff --git a/storage/filesystem/internal/dotgit/dotgit_test.go b/storage/filesystem/internal/dotgit/dotgit_test.go index a5d25e3..bcd8d96 100644 --- a/storage/filesystem/internal/dotgit/dotgit_test.go +++ b/storage/filesystem/internal/dotgit/dotgit_test.go @@ -7,8 +7,8 @@ import ( "strings" "testing" - "gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/fixtures" + "gopkg.in/src-d/go-git.v4/plumbing" osfs "gopkg.in/src-d/go-git.v4/utils/fs/os" . "gopkg.in/check.v1" @@ -30,21 +30,21 @@ func (s *SuiteDotGit) TestSetRefs(c *C) { fs := osfs.New(tmp) dir := New(fs) - err = dir.SetRef(core.NewReferenceFromStrings( + err = dir.SetRef(plumbing.NewReferenceFromStrings( "refs/heads/foo", "e8d3ffab552895c19b9fcf7aa264d277cde33881", )) c.Assert(err, IsNil) - err = dir.SetRef(core.NewReferenceFromStrings( + err = dir.SetRef(plumbing.NewReferenceFromStrings( "refs/heads/symbolic", "ref: refs/heads/foo", )) c.Assert(err, IsNil) - err = dir.SetRef(core.NewReferenceFromStrings( + err = dir.SetRef(plumbing.NewReferenceFromStrings( "bar", "e8d3ffab552895c19b9fcf7aa264d277cde33881", )) @@ -103,7 +103,7 @@ func (s *SuiteDotGit) TestRefsFromReferenceFile(c *C) { ref := findReference(refs, "refs/remotes/origin/HEAD") c.Assert(ref, NotNil) - c.Assert(ref.Type(), Equals, core.SymbolicReference) + c.Assert(ref.Type(), Equals, plumbing.SymbolicReference) c.Assert(string(ref.Target()), Equals, "refs/remotes/origin/master") } @@ -117,7 +117,7 @@ func (s *SuiteDotGit) TestRefsFromHEADFile(c *C) { ref := findReference(refs, "HEAD") c.Assert(ref, NotNil) - c.Assert(ref.Type(), Equals, core.SymbolicReference) + c.Assert(ref.Type(), Equals, plumbing.SymbolicReference) c.Assert(string(ref.Target()), Equals, "refs/heads/master") } @@ -130,8 +130,8 @@ func (s *SuiteDotGit) TestConfig(c *C) { c.Assert(filepath.Base(file.Filename()), Equals, "config") } -func findReference(refs []*core.Reference, name string) *core.Reference { - n := core.ReferenceName(name) +func findReference(refs []*plumbing.Reference, name string) *plumbing.Reference { + n := plumbing.ReferenceName(name) for _, ref := range refs { if ref.Name() == n { return ref @@ -176,11 +176,11 @@ func (s *SuiteDotGit) TestObjectPackNotFound(c *C) { fs := fixtures.Basic().ByTag(".git").One().DotGit() dir := New(fs) - pack, err := dir.ObjectPack(core.ZeroHash) + pack, err := dir.ObjectPack(plumbing.ZeroHash) c.Assert(err, Equals, ErrPackfileNotFound) c.Assert(pack, IsNil) - idx, err := dir.ObjectPackIdx(core.ZeroHash) + idx, err := dir.ObjectPackIdx(plumbing.ZeroHash) c.Assert(idx, IsNil) } @@ -194,7 +194,7 @@ func (s *SuiteDotGit) TestNewObject(c *C) { w, err := dir.NewObject() c.Assert(err, IsNil) - err = w.WriteHeader(core.BlobObject, 14) + err = w.WriteHeader(plumbing.BlobObject, 14) n, err := w.Write([]byte("this is a test")) c.Assert(err, IsNil) c.Assert(n, Equals, 14) @@ -225,7 +225,7 @@ func (s *SuiteDotGit) TestObject(c *C) { fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit() dir := New(fs) - hash := core.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e") + hash := plumbing.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e") file, err := dir.Object(hash) c.Assert(err, IsNil) c.Assert(strings.HasSuffix( @@ -238,7 +238,7 @@ func (s *SuiteDotGit) TestObjectNotFound(c *C) { fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit() dir := New(fs) - hash := core.NewHash("not-found-object") + hash := plumbing.NewHash("not-found-object") file, err := dir.Object(hash) c.Assert(err, NotNil) c.Assert(file, IsNil) diff --git a/storage/filesystem/internal/dotgit/writers.go b/storage/filesystem/internal/dotgit/writers.go index 4641572..d3d3b43 100644 --- a/storage/filesystem/internal/dotgit/writers.go +++ b/storage/filesystem/internal/dotgit/writers.go @@ -5,20 +5,20 @@ import ( "io" "sync/atomic" - "gopkg.in/src-d/go-git.v4/core" - "gopkg.in/src-d/go-git.v4/formats/idxfile" - "gopkg.in/src-d/go-git.v4/formats/objfile" - "gopkg.in/src-d/go-git.v4/formats/packfile" + "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/format/idxfile" + "gopkg.in/src-d/go-git.v4/plumbing/format/objfile" + "gopkg.in/src-d/go-git.v4/plumbing/format/packfile" "gopkg.in/src-d/go-git.v4/utils/fs" ) type PackWriter struct { - Notify func(h core.Hash, i idxfile.Idxfile) + Notify func(h plumbing.Hash, i idxfile.Idxfile) fs fs.Filesystem fr, fw fs.File synced *syncedReader - checksum core.Hash + checksum plumbing.Hash index idxfile.Idxfile result chan error } diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go index f780183..5868748 100644 --- a/storage/filesystem/object.go +++ b/storage/filesystem/object.go @@ -4,10 +4,11 @@ import ( "io" "os" - "gopkg.in/src-d/go-git.v4/core" - "gopkg.in/src-d/go-git.v4/formats/idxfile" - "gopkg.in/src-d/go-git.v4/formats/objfile" - "gopkg.in/src-d/go-git.v4/formats/packfile" + "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/format/idxfile" + "gopkg.in/src-d/go-git.v4/plumbing/format/objfile" + "gopkg.in/src-d/go-git.v4/plumbing/format/packfile" + "gopkg.in/src-d/go-git.v4/plumbing/storer" "gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit" "gopkg.in/src-d/go-git.v4/storage/memory" "gopkg.in/src-d/go-git.v4/utils/fs" @@ -15,13 +16,13 @@ import ( type ObjectStorage struct { dir *dotgit.DotGit - index map[core.Hash]index + index map[plumbing.Hash]index } func newObjectStorage(dir *dotgit.DotGit) (ObjectStorage, error) { s := ObjectStorage{ dir: dir, - index: make(map[core.Hash]index, 0), + index: make(map[plumbing.Hash]index, 0), } return s, s.loadIdxFiles() @@ -42,7 +43,7 @@ func (s *ObjectStorage) loadIdxFiles() error { return nil } -func (s *ObjectStorage) loadIdxFile(h core.Hash) error { +func (s *ObjectStorage) loadIdxFile(h plumbing.Hash) error { idx, err := s.dir.ObjectPackIdx(h) if err != nil { return err @@ -52,8 +53,8 @@ func (s *ObjectStorage) loadIdxFile(h core.Hash) error { return s.index[h].Decode(idx) } -func (s *ObjectStorage) NewObject() core.Object { - return &core.MemoryObject{} +func (s *ObjectStorage) NewObject() plumbing.Object { + return &plumbing.MemoryObject{} } func (s *ObjectStorage) PackfileWriter() (io.WriteCloser, error) { @@ -62,7 +63,7 @@ func (s *ObjectStorage) PackfileWriter() (io.WriteCloser, error) { return nil, err } - w.Notify = func(h core.Hash, idx idxfile.Idxfile) { + w.Notify = func(h plumbing.Hash, idx idxfile.Idxfile) { s.index[h] = make(index) for _, e := range idx.Entries { s.index[h][e.Hash] = int64(e.Offset) @@ -73,31 +74,31 @@ func (s *ObjectStorage) PackfileWriter() (io.WriteCloser, error) { } // Set adds a new object to the storage. -func (s *ObjectStorage) SetObject(o core.Object) (core.Hash, error) { - if o.Type() == core.OFSDeltaObject || o.Type() == core.REFDeltaObject { - return core.ZeroHash, core.ErrInvalidType +func (s *ObjectStorage) SetObject(o plumbing.Object) (plumbing.Hash, error) { + if o.Type() == plumbing.OFSDeltaObject || o.Type() == plumbing.REFDeltaObject { + return plumbing.ZeroHash, plumbing.ErrInvalidType } ow, err := s.dir.NewObject() if err != nil { - return core.ZeroHash, err + return plumbing.ZeroHash, err } defer ow.Close() or, err := o.Reader() if err != nil { - return core.ZeroHash, err + return plumbing.ZeroHash, err } defer or.Close() if err := ow.WriteHeader(o.Type(), o.Size()); err != nil { - return core.ZeroHash, err + return plumbing.ZeroHash, err } if _, err := io.Copy(ow, or); err != nil { - return core.ZeroHash, err + return plumbing.ZeroHash, err } return o.Hash(), nil @@ -105,9 +106,9 @@ func (s *ObjectStorage) SetObject(o core.Object) (core.Hash, error) { // Get returns the object with the given hash, by searching for it in // the packfile and the git object directories. -func (s *ObjectStorage) Object(t core.ObjectType, h core.Hash) (core.Object, error) { +func (s *ObjectStorage) Object(t plumbing.ObjectType, h plumbing.Hash) (plumbing.Object, error) { obj, err := s.getFromUnpacked(h) - if err == core.ErrObjectNotFound { + if err == plumbing.ErrObjectNotFound { obj, err = s.getFromPackfile(h) } @@ -115,18 +116,18 @@ func (s *ObjectStorage) Object(t core.ObjectType, h core.Hash) (core.Object, err return nil, err } - if core.AnyObject != t && obj.Type() != t { - return nil, core.ErrObjectNotFound + if plumbing.AnyObject != t && obj.Type() != t { + return nil, plumbing.ErrObjectNotFound } return obj, nil } -func (s *ObjectStorage) getFromUnpacked(h core.Hash) (obj core.Object, err error) { +func (s *ObjectStorage) getFromUnpacked(h plumbing.Hash) (obj plumbing.Object, err error) { f, err := s.dir.Object(h) if err != nil { if os.IsNotExist(err) { - return nil, core.ErrObjectNotFound + return nil, plumbing.ErrObjectNotFound } return nil, err @@ -160,10 +161,10 @@ func (s *ObjectStorage) getFromUnpacked(h core.Hash) (obj core.Object, err error // Get returns the object with the given hash, by searching for it in // the packfile. -func (s *ObjectStorage) getFromPackfile(h core.Hash) (core.Object, error) { +func (s *ObjectStorage) getFromPackfile(h plumbing.Hash) (plumbing.Object, error) { pack, offset := s.findObjectInPackfile(h) if offset == -1 { - return nil, core.ErrObjectNotFound + return nil, plumbing.ErrObjectNotFound } f, err := s.dir.ObjectPack(pack) @@ -183,26 +184,26 @@ func (s *ObjectStorage) getFromPackfile(h core.Hash) (core.Object, error) { return d.ReadObjectAt(offset) } -func (s *ObjectStorage) findObjectInPackfile(h core.Hash) (core.Hash, int64) { +func (s *ObjectStorage) findObjectInPackfile(h plumbing.Hash) (plumbing.Hash, int64) { for packfile, index := range s.index { if offset, ok := index[h]; ok { return packfile, offset } } - return core.ZeroHash, -1 + return plumbing.ZeroHash, -1 } // Iter returns an iterator for all the objects in the packfile with the // given type. -func (s *ObjectStorage) IterObjects(t core.ObjectType) (core.ObjectIter, error) { +func (s *ObjectStorage) IterObjects(t plumbing.ObjectType) (storer.ObjectIter, error) { objects, err := s.dir.Objects() if err != nil { return nil, err } - seen := make(map[core.Hash]bool, 0) - var iters []core.ObjectIter + seen := make(map[plumbing.Hash]bool, 0) + var iters []storer.ObjectIter if len(objects) != 0 { iters = append(iters, &objectsIter{s: s, t: t, h: objects}) seen = hashListAsMap(objects) @@ -214,17 +215,17 @@ func (s *ObjectStorage) IterObjects(t core.ObjectType) (core.ObjectIter, error) } iters = append(iters, packi...) - return core.NewMultiObjectIter(iters), nil + return storer.NewMultiObjectIter(iters), nil } func (s *ObjectStorage) buildPackfileIters( - t core.ObjectType, seen map[core.Hash]bool) ([]core.ObjectIter, error) { + t plumbing.ObjectType, seen map[plumbing.Hash]bool) ([]storer.ObjectIter, error) { packs, err := s.dir.ObjectPacks() if err != nil { return nil, err } - var iters []core.ObjectIter + var iters []storer.ObjectIter for _, h := range packs { pack, err := s.dir.ObjectPack(h) if err != nil { @@ -242,7 +243,7 @@ func (s *ObjectStorage) buildPackfileIters( return iters, nil } -type index map[core.Hash]int64 +type index map[plumbing.Hash]int64 func (i index) Decode(r io.Reader) error { idx := &idxfile.Idxfile{} @@ -262,14 +263,14 @@ func (i index) Decode(r io.Reader) error { type packfileIter struct { f fs.File d *packfile.Decoder - t core.ObjectType + t plumbing.ObjectType - seen map[core.Hash]bool + seen map[plumbing.Hash]bool position uint32 total uint32 } -func newPackfileIter(f fs.File, t core.ObjectType, seen map[core.Hash]bool) (core.ObjectIter, error) { +func newPackfileIter(f fs.File, t plumbing.ObjectType, seen map[plumbing.Hash]bool) (storer.ObjectIter, error) { s := packfile.NewScanner(f) _, total, err := s.Header() if err != nil { @@ -291,7 +292,7 @@ func newPackfileIter(f fs.File, t core.ObjectType, seen map[core.Hash]bool) (cor }, nil } -func (iter *packfileIter) Next() (core.Object, error) { +func (iter *packfileIter) Next() (plumbing.Object, error) { if iter.position >= iter.total { return nil, io.EOF } @@ -306,7 +307,7 @@ func (iter *packfileIter) Next() (core.Object, error) { return iter.Next() } - if iter.t != core.AnyObject && iter.t != obj.Type() { + if iter.t != plumbing.AnyObject && iter.t != obj.Type() { return iter.Next() } @@ -314,7 +315,7 @@ func (iter *packfileIter) Next() (core.Object, error) { } // ForEach is never called since is used inside of a MultiObjectIterator -func (iter *packfileIter) ForEach(cb func(core.Object) error) error { +func (iter *packfileIter) ForEach(cb func(plumbing.Object) error) error { return nil } @@ -325,11 +326,11 @@ func (iter *packfileIter) Close() { type objectsIter struct { s *ObjectStorage - t core.ObjectType - h []core.Hash + t plumbing.ObjectType + h []plumbing.Hash } -func (iter *objectsIter) Next() (core.Object, error) { +func (iter *objectsIter) Next() (plumbing.Object, error) { if len(iter.h) == 0 { return nil, io.EOF } @@ -341,7 +342,7 @@ func (iter *objectsIter) Next() (core.Object, error) { return nil, err } - if iter.t != core.AnyObject && iter.t != obj.Type() { + if iter.t != plumbing.AnyObject && iter.t != obj.Type() { return iter.Next() } @@ -349,16 +350,16 @@ func (iter *objectsIter) Next() (core.Object, error) { } // ForEach is never called since is used inside of a MultiObjectIterator -func (iter *objectsIter) ForEach(cb func(core.Object) error) error { +func (iter *objectsIter) ForEach(cb func(plumbing.Object) error) error { return nil } func (iter *objectsIter) Close() { - iter.h = []core.Hash{} + iter.h = []plumbing.Hash{} } -func hashListAsMap(l []core.Hash) map[core.Hash]bool { - m := make(map[core.Hash]bool, len(l)) +func hashListAsMap(l []plumbing.Hash) map[plumbing.Hash]bool { + m := make(map[plumbing.Hash]bool, len(l)) for _, h := range l { m[h] = true } diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go index 38e4b6d..f839420 100644 --- a/storage/filesystem/object_test.go +++ b/storage/filesystem/object_test.go @@ -1,8 +1,8 @@ package filesystem import ( - "gopkg.in/src-d/go-git.v4/core" "gopkg.in/src-d/go-git.v4/fixtures" + "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit" . "gopkg.in/check.v1" @@ -19,8 +19,8 @@ func (s *FsSuite) TestGetFromObjectFile(c *C) { o, err := newObjectStorage(dotgit.New(fs)) c.Assert(err, IsNil) - expected := core.NewHash("f3dfe29d268303fc6e1bbce268605fc99573406e") - obj, err := o.Object(core.AnyObject, expected) + expected := plumbing.NewHash("f3dfe29d268303fc6e1bbce268605fc99573406e") + obj, err := o.Object(plumbing.AnyObject, expected) c.Assert(err, IsNil) c.Assert(obj.Hash(), Equals, expected) } @@ -31,8 +31,8 @@ func (s *FsSuite) TestGetFromPackfile(c *C) { o, err := newObjectStorage(dotgit.New(fs)) c.Assert(err, IsNil) - expected := core.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5") - obj, err := o.Object(core.AnyObject, expected) + expected := plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5") + obj, err := o.Object(plumbing.AnyObject, expected) c.Assert(err, IsNil) c.Assert(obj.Hash(), Equals, expected) }) @@ -43,12 +43,12 @@ func (s *FsSuite) TestGetFromPackfileMultiplePackfiles(c *C) { o, err := newObjectStorage(dotgit.New(fs)) c.Assert(err, IsNil) - expected := core.NewHash("8d45a34641d73851e01d3754320b33bb5be3c4d3") + expected := plumbing.NewHash("8d45a34641d73851e01d3754320b33bb5be3c4d3") obj, err := o.getFromPackfile(expected) c.Assert(err, IsNil) c.Assert(obj.Hash(), Equals, expected) - expected = core.NewHash("e9cfa4c9ca160546efd7e8582ec77952a27b17db") + expected = plumbing.NewHash("e9cfa4c9ca160546efd7e8582ec77952a27b17db") obj, err = o.getFromPackfile(expected) c.Assert(err, IsNil) c.Assert(obj.Hash(), Equals, expected) @@ -60,11 +60,11 @@ func (s *FsSuite) TestIter(c *C) { o, err := newObjectStorage(dotgit.New(fs)) c.Assert(err, IsNil) - iter, err := o.IterObjects(core.AnyObject) + iter, err := o.IterObjects(plumbing.AnyObject) c.Assert(err, IsNil) var count int32 - err = iter.ForEach(func(o core.Object) error { + err = iter.ForEach(func(o plumbing.Object) error { count++ return nil }) @@ -80,11 +80,11 @@ func (s *FsSuite) TestIterWithType(c *C) { o, err := newObjectStorage(dotgit.New(fs)) c.Assert(err, IsNil) - iter, err := o.IterObjects(core.CommitObject) + iter, err := o.IterObjects(plumbing.CommitObject) c.Assert(err, IsNil) - err = iter.ForEach(func(o core.Object) error { - c.Assert(o.Type(), Equals, core.CommitObject) + err = iter.ForEach(func(o plumbing.Object) error { + c.Assert(o.Type(), Equals, plumbing.CommitObject) return nil }) diff --git a/storage/filesystem/reference.go b/storage/filesystem/reference.go index 0015859..93da68c 100644 --- a/storage/filesystem/reference.go +++ b/storage/filesystem/reference.go @@ -1,7 +1,8 @@ package filesystem import ( - "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/storer" "gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit" ) @@ -9,19 +10,19 @@ type ReferenceStorage struct { dir *dotgit.DotGit } -func (r *ReferenceStorage) SetReference(ref *core.Reference) error { +func (r *ReferenceStorage) SetReference(ref *plumbing.Reference) error { return r.dir.SetRef(ref) } -func (r *ReferenceStorage) Reference(n core.ReferenceName) (*core.Reference, error) { +func (r *ReferenceStorage) Reference(n plumbing.ReferenceName) (*plumbing.Reference, error) { return r.dir.Ref(n) } -func (r *ReferenceStorage) IterReferences() (core.ReferenceIter, error) { +func (r *ReferenceStorage) IterReferences() (storer.ReferenceIter, error) { refs, err := r.dir.Refs() if err != nil { return nil, err } - return core.NewReferenceSliceIter(refs), nil + return storer.NewReferenceSliceIter(refs), nil } diff --git a/storage/memory/storage.go b/storage/memory/storage.go index 8141cfc..a7a2150 100644 --- a/storage/memory/storage.go +++ b/storage/memory/storage.go @@ -5,7 +5,8 @@ import ( "fmt" "gopkg.in/src-d/go-git.v4/config" - "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/storer" ) var ErrUnsupportedObjectType = fmt.Errorf("unsupported object type") @@ -26,11 +27,11 @@ func NewStorage() *Storage { ReferenceStorage: make(ReferenceStorage, 0), ConfigStorage: ConfigStorage{}, ObjectStorage: ObjectStorage{ - Objects: make(map[core.Hash]core.Object, 0), - Commits: make(map[core.Hash]core.Object, 0), - Trees: make(map[core.Hash]core.Object, 0), - Blobs: make(map[core.Hash]core.Object, 0), - Tags: make(map[core.Hash]core.Object, 0), + Objects: make(map[plumbing.Hash]plumbing.Object, 0), + Commits: make(map[plumbing.Hash]plumbing.Object, 0), + Trees: make(map[plumbing.Hash]plumbing.Object, 0), + Blobs: make(map[plumbing.Hash]plumbing.Object, 0), + Tags: make(map[plumbing.Hash]plumbing.Object, 0), }, } } @@ -57,29 +58,29 @@ func (c *ConfigStorage) Config() (*config.Config, error) { } type ObjectStorage struct { - Objects map[core.Hash]core.Object - Commits map[core.Hash]core.Object - Trees map[core.Hash]core.Object - Blobs map[core.Hash]core.Object - Tags map[core.Hash]core.Object + Objects map[plumbing.Hash]plumbing.Object + Commits map[plumbing.Hash]plumbing.Object + Trees map[plumbing.Hash]plumbing.Object + Blobs map[plumbing.Hash]plumbing.Object + Tags map[plumbing.Hash]plumbing.Object } -func (o *ObjectStorage) NewObject() core.Object { - return &core.MemoryObject{} +func (o *ObjectStorage) NewObject() plumbing.Object { + return &plumbing.MemoryObject{} } -func (o *ObjectStorage) SetObject(obj core.Object) (core.Hash, error) { +func (o *ObjectStorage) SetObject(obj plumbing.Object) (plumbing.Hash, error) { h := obj.Hash() o.Objects[h] = obj switch obj.Type() { - case core.CommitObject: + case plumbing.CommitObject: o.Commits[h] = o.Objects[h] - case core.TreeObject: + case plumbing.TreeObject: o.Trees[h] = o.Objects[h] - case core.BlobObject: + case plumbing.BlobObject: o.Blobs[h] = o.Objects[h] - case core.TagObject: + case plumbing.TagObject: o.Tags[h] = o.Objects[h] default: return h, ErrUnsupportedObjectType @@ -88,64 +89,64 @@ func (o *ObjectStorage) SetObject(obj core.Object) (core.Hash, error) { return h, nil } -func (o *ObjectStorage) Object(t core.ObjectType, h core.Hash) (core.Object, error) { +func (o *ObjectStorage) Object(t plumbing.ObjectType, h plumbing.Hash) (plumbing.Object, error) { obj, ok := o.Objects[h] - if !ok || (core.AnyObject != t && obj.Type() != t) { - return nil, core.ErrObjectNotFound + if !ok || (plumbing.AnyObject != t && obj.Type() != t) { + return nil, plumbing.ErrObjectNotFound } return obj, nil } -func (o *ObjectStorage) IterObjects(t core.ObjectType) (core.ObjectIter, error) { - var series []core.Object +func (o *ObjectStorage) IterObjects(t plumbing.ObjectType) (storer.ObjectIter, error) { + var series []plumbing.Object switch t { - case core.AnyObject: + case plumbing.AnyObject: series = flattenObjectMap(o.Objects) - case core.CommitObject: + case plumbing.CommitObject: series = flattenObjectMap(o.Commits) - case core.TreeObject: + case plumbing.TreeObject: series = flattenObjectMap(o.Trees) - case core.BlobObject: + case plumbing.BlobObject: series = flattenObjectMap(o.Blobs) - case core.TagObject: + case plumbing.TagObject: series = flattenObjectMap(o.Tags) } - return core.NewObjectSliceIter(series), nil + return storer.NewObjectSliceIter(series), nil } -func flattenObjectMap(m map[core.Hash]core.Object) []core.Object { - objects := make([]core.Object, 0, len(m)) +func flattenObjectMap(m map[plumbing.Hash]plumbing.Object) []plumbing.Object { + objects := make([]plumbing.Object, 0, len(m)) for _, obj := range m { objects = append(objects, obj) } return objects } -func (o *ObjectStorage) Begin() core.Transaction { +func (o *ObjectStorage) Begin() storer.Transaction { return &TxObjectStorage{ Storage: o, - Objects: make(map[core.Hash]core.Object, 0), + Objects: make(map[plumbing.Hash]plumbing.Object, 0), } } type TxObjectStorage struct { Storage *ObjectStorage - Objects map[core.Hash]core.Object + Objects map[plumbing.Hash]plumbing.Object } -func (tx *TxObjectStorage) SetObject(obj core.Object) (core.Hash, error) { +func (tx *TxObjectStorage) SetObject(obj plumbing.Object) (plumbing.Hash, error) { h := obj.Hash() tx.Objects[h] = obj return h, nil } -func (tx *TxObjectStorage) Object(t core.ObjectType, h core.Hash) (core.Object, error) { +func (tx *TxObjectStorage) Object(t plumbing.ObjectType, h plumbing.Hash) (plumbing.Object, error) { obj, ok := tx.Objects[h] - if !ok || (core.AnyObject != t && obj.Type() != t) { - return nil, core.ErrObjectNotFound + if !ok || (plumbing.AnyObject != t && obj.Type() != t) { + return nil, plumbing.ErrObjectNotFound } return obj, nil @@ -163,13 +164,13 @@ func (tx *TxObjectStorage) Commit() error { } func (tx *TxObjectStorage) Rollback() error { - tx.Objects = make(map[core.Hash]core.Object, 0) + tx.Objects = make(map[plumbing.Hash]plumbing.Object, 0) return nil } -type ReferenceStorage map[core.ReferenceName]*core.Reference +type ReferenceStorage map[plumbing.ReferenceName]*plumbing.Reference -func (r ReferenceStorage) SetReference(ref *core.Reference) error { +func (r ReferenceStorage) SetReference(ref *plumbing.Reference) error { if ref != nil { r[ref.Name()] = ref } @@ -177,20 +178,20 @@ func (r ReferenceStorage) SetReference(ref *core.Reference) error { return nil } -func (r ReferenceStorage) Reference(n core.ReferenceName) (*core.Reference, error) { +func (r ReferenceStorage) Reference(n plumbing.ReferenceName) (*plumbing.Reference, error) { ref, ok := r[n] if !ok { - return nil, core.ErrReferenceNotFound + return nil, plumbing.ErrReferenceNotFound } return ref, nil } -func (r ReferenceStorage) IterReferences() (core.ReferenceIter, error) { - var refs []*core.Reference +func (r ReferenceStorage) IterReferences() (storer.ReferenceIter, error) { + var refs []*plumbing.Reference for _, ref := range r { refs = append(refs, ref) } - return core.NewReferenceSliceIter(refs), nil + return storer.NewReferenceSliceIter(refs), nil } diff --git a/storage/test/storage_suite.go b/storage/test/storage_suite.go index 451528f..d5e1464 100644 --- a/storage/test/storage_suite.go +++ b/storage/test/storage_suite.go @@ -8,53 +8,54 @@ import ( "io/ioutil" "gopkg.in/src-d/go-git.v4/config" - "gopkg.in/src-d/go-git.v4/core" + "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/storer" . "gopkg.in/check.v1" ) -type storer interface { - core.ObjectStorer - core.ReferenceStorer +type Storer interface { + storer.ObjectStorer + storer.ReferenceStorer config.ConfigStorer } type TestObject struct { - Object core.Object + Object plumbing.Object Hash string - Type core.ObjectType + Type plumbing.ObjectType } type BaseStorageSuite struct { - Storer storer + Storer Storer - validTypes []core.ObjectType - testObjects map[core.ObjectType]TestObject + validTypes []plumbing.ObjectType + testObjects map[plumbing.ObjectType]TestObject } -func NewBaseStorageSuite(s storer) BaseStorageSuite { - commit := &core.MemoryObject{} - commit.SetType(core.CommitObject) - tree := &core.MemoryObject{} - tree.SetType(core.TreeObject) - blob := &core.MemoryObject{} - blob.SetType(core.BlobObject) - tag := &core.MemoryObject{} - tag.SetType(core.TagObject) +func NewBaseStorageSuite(s Storer) BaseStorageSuite { + commit := &plumbing.MemoryObject{} + commit.SetType(plumbing.CommitObject) + tree := &plumbing.MemoryObject{} + tree.SetType(plumbing.TreeObject) + blob := &plumbing.MemoryObject{} + blob.SetType(plumbing.BlobObject) + tag := &plumbing.MemoryObject{} + tag.SetType(plumbing.TagObject) return BaseStorageSuite{ Storer: s, - validTypes: []core.ObjectType{ - core.CommitObject, - core.BlobObject, - core.TagObject, - core.TreeObject, + validTypes: []plumbing.ObjectType{ + plumbing.CommitObject, + plumbing.BlobObject, + plumbing.TagObject, + plumbing.TreeObject, }, - testObjects: map[core.ObjectType]TestObject{ - core.CommitObject: {commit, "dcf5b16e76cce7425d0beaef62d79a7d10fce1f5", core.CommitObject}, - core.TreeObject: {tree, "4b825dc642cb6eb9a060e54bf8d69288fbee4904", core.TreeObject}, - core.BlobObject: {blob, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", core.BlobObject}, - core.TagObject: {tag, "d994c6bb648123a17e8f70a966857c546b2a6f94", core.TagObject}, + testObjects: map[plumbing.ObjectType]TestObject{ + plumbing.CommitObject: {commit, "dcf5b16e76cce7425d0beaef62d79a7d10fce1f5", plumbing.CommitObject}, + plumbing.TreeObject: {tree, "4b825dc642cb6eb9a060e54bf8d69288fbee4904", plumbing.TreeObject}, + plumbing.BlobObject: {blob, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", plumbing.BlobObject}, + plumbing.TagObject: {tag, "d994c6bb648123a17e8f70a966857c546b2a6f94", plumbing.TagObject}, }} } @@ -70,7 +71,7 @@ func (s *BaseStorageSuite) TestSetObjectAndGetObject(c *C) { c.Assert(err, IsNil) c.Assert(objectEquals(o, to.Object), IsNil) - o, err = s.Storer.Object(core.AnyObject, h) + o, err = s.Storer.Object(plumbing.AnyObject, h) c.Assert(err, IsNil) c.Assert(objectEquals(o, to.Object), IsNil) @@ -81,14 +82,14 @@ func (s *BaseStorageSuite) TestSetObjectAndGetObject(c *C) { o, err = s.Storer.Object(t, h) c.Assert(o, IsNil) - c.Assert(err, Equals, core.ErrObjectNotFound) + c.Assert(err, Equals, plumbing.ErrObjectNotFound) } } } func (s *BaseStorageSuite) TestSetObjectInvalid(c *C) { o := s.Storer.NewObject() - o.SetType(core.REFDeltaObject) + o.SetType(plumbing.REFDeltaObject) _, err := s.Storer.SetObject(o) c.Assert(err, NotNil) @@ -115,11 +116,11 @@ func (s *BaseStorageSuite) TestStorerIter(c *C) { c.Assert(err, Equals, io.EOF, comment) } - i, err := s.Storer.IterObjects(core.AnyObject) + i, err := s.Storer.IterObjects(plumbing.AnyObject) c.Assert(err, IsNil) - foundObjects := []core.Object{} - i.ForEach(func(o core.Object) error { + foundObjects := []plumbing.Object{} + i.ForEach(func(o plumbing.Object) error { foundObjects = append(foundObjects, o) return nil }) @@ -138,9 +139,9 @@ func (s *BaseStorageSuite) TestStorerIter(c *C) { } func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndCommit(c *C) { - storer, ok := s.Storer.(core.Transactioner) + storer, ok := s.Storer.(storer.Transactioner) if !ok { - c.Skip("not a core.ObjectStorerTx") + c.Skip("not a plumbing.ObjectStorerTx") } tx := storer.Begin() @@ -150,7 +151,7 @@ func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndCommit(c *C) { c.Assert(h.String(), Equals, o.Hash) } - iter, err := s.Storer.IterObjects(core.AnyObject) + iter, err := s.Storer.IterObjects(plumbing.AnyObject) c.Assert(err, IsNil) _, err = iter.Next() c.Assert(err, Equals, io.EOF) @@ -158,11 +159,11 @@ func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndCommit(c *C) { err = tx.Commit() c.Assert(err, IsNil) - iter, err = s.Storer.IterObjects(core.AnyObject) + iter, err = s.Storer.IterObjects(plumbing.AnyObject) c.Assert(err, IsNil) var count int - iter.ForEach(func(o core.Object) error { + iter.ForEach(func(o plumbing.Object) error { count++ return nil }) @@ -171,9 +172,9 @@ func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndCommit(c *C) { } func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndGetObject(c *C) { - storer, ok := s.Storer.(core.Transactioner) + storer, ok := s.Storer.(storer.Transactioner) if !ok { - c.Skip("not a core.ObjectStorerTx") + c.Skip("not a plumbing.ObjectStorerTx") } tx := storer.Begin() @@ -182,27 +183,27 @@ func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndGetObject(c *C) { c.Assert(err, IsNil) c.Assert(h.String(), Equals, expected.Hash) - o, err := tx.Object(expected.Type, core.NewHash(expected.Hash)) + o, err := tx.Object(expected.Type, plumbing.NewHash(expected.Hash)) c.Assert(o.Hash().String(), DeepEquals, expected.Hash) } } func (s *BaseStorageSuite) TestObjectStorerTxGetObjectNotFound(c *C) { - storer, ok := s.Storer.(core.Transactioner) + storer, ok := s.Storer.(storer.Transactioner) if !ok { - c.Skip("not a core.ObjectStorerTx") + c.Skip("not a plumbing.ObjectStorerTx") } tx := storer.Begin() - o, err := tx.Object(core.AnyObject, core.ZeroHash) + o, err := tx.Object(plumbing.AnyObject, plumbing.ZeroHash) c.Assert(o, IsNil) - c.Assert(err, Equals, core.ErrObjectNotFound) + c.Assert(err, Equals, plumbing.ErrObjectNotFound) } func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndRollback(c *C) { - storer, ok := s.Storer.(core.Transactioner) + storer, ok := s.Storer.(storer.Transactioner) if !ok { - c.Skip("not a core.ObjectStorerTx") + c.Skip("not a plumbing.ObjectStorerTx") } tx := storer.Begin() @@ -215,7 +216,7 @@ func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndRollback(c *C) { err := tx.Rollback() c.Assert(err, IsNil) - iter, err := s.Storer.IterObjects(core.AnyObject) + iter, err := s.Storer.IterObjects(plumbing.AnyObject) c.Assert(err, IsNil) _, err = iter.Next() c.Assert(err, Equals, io.EOF) @@ -223,29 +224,29 @@ func (s *BaseStorageSuite) TestObjectStorerTxSetObjectAndRollback(c *C) { func (s *BaseStorageSuite) TestSetReferenceAndGetReference(c *C) { err := s.Storer.SetReference( - core.NewReferenceFromStrings("foo", "bc9968d75e48de59f0870ffb71f5e160bbbdcf52"), + plumbing.NewReferenceFromStrings("foo", "bc9968d75e48de59f0870ffb71f5e160bbbdcf52"), ) c.Assert(err, IsNil) err = s.Storer.SetReference( - core.NewReferenceFromStrings("bar", "482e0eada5de4039e6f216b45b3c9b683b83bfa"), + plumbing.NewReferenceFromStrings("bar", "482e0eada5de4039e6f216b45b3c9b683b83bfa"), ) c.Assert(err, IsNil) - e, err := s.Storer.Reference(core.ReferenceName("foo")) + e, err := s.Storer.Reference(plumbing.ReferenceName("foo")) c.Assert(err, IsNil) c.Assert(e.Hash().String(), Equals, "bc9968d75e48de59f0870ffb71f5e160bbbdcf52") } func (s *BaseStorageSuite) TestGetReferenceNotFound(c *C) { - r, err := s.Storer.Reference(core.ReferenceName("bar")) - c.Assert(err, Equals, core.ErrReferenceNotFound) + r, err := s.Storer.Reference(plumbing.ReferenceName("bar")) + c.Assert(err, Equals, plumbing.ErrReferenceNotFound) c.Assert(r, IsNil) } func (s *BaseStorageSuite) TestIterReferences(c *C) { err := s.Storer.SetReference( - core.NewReferenceFromStrings("refs/foo", "bc9968d75e48de59f0870ffb71f5e160bbbdcf52"), + plumbing.NewReferenceFromStrings("refs/foo", "bc9968d75e48de59f0870ffb71f5e160bbbdcf52"), ) c.Assert(err, IsNil) @@ -284,7 +285,7 @@ func (s *BaseStorageSuite) TestSetConfigInvalid(c *C) { c.Assert(err, NotNil) } -func objectEquals(a core.Object, b core.Object) error { +func objectEquals(a plumbing.Object, b plumbing.Object) error { ha := a.Hash() hb := b.Hash() if ha != hb { |