diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-07-27 18:04:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-27 18:04:00 +0200 |
commit | 86f33ed017b55898758bf8900a085f355b2793d0 (patch) | |
tree | 1e741bed0672a7afb62cda37ca0b1d86fad52889 /plumbing/format/packfile/encoder_test.go | |
parent | 7b08a3005480a50f0f4290aff8f3702085d5e30d (diff) | |
parent | 16b24f84e9342234ad90da27a6532887b05d1965 (diff) | |
download | go-git-86f33ed017b55898758bf8900a085f355b2793d0.tar.gz |
Merge pull request #515 from smola/reuse-packed-objects
storage: reuse deltas from packfiles
Diffstat (limited to 'plumbing/format/packfile/encoder_test.go')
-rw-r--r-- | plumbing/format/packfile/encoder_test.go | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/plumbing/format/packfile/encoder_test.go b/plumbing/format/packfile/encoder_test.go index fa01ed0..b5b0c42 100644 --- a/plumbing/format/packfile/encoder_test.go +++ b/plumbing/format/packfile/encoder_test.go @@ -86,68 +86,6 @@ func (s *EncoderSuite) TestHashNotFound(c *C) { c.Assert(err, Equals, plumbing.ErrObjectNotFound) } -func (s *EncoderSuite) TestDecodeEncodeDecode(c *C) { - fixtures.Basic().ByTag("packfile").Test(c, func(f *fixtures.Fixture) { - scanner := NewScanner(f.Packfile()) - storage := memory.NewStorage() - - d, err := NewDecoder(scanner, storage) - c.Assert(err, IsNil) - - ch, err := d.Decode() - c.Assert(err, IsNil) - c.Assert(ch, Equals, f.PackfileHash) - - objIter, err := d.o.IterEncodedObjects(plumbing.AnyObject) - c.Assert(err, IsNil) - - objects := []plumbing.EncodedObject{} - hashes := []plumbing.Hash{} - err = objIter.ForEach(func(o plumbing.EncodedObject) error { - objects = append(objects, o) - hash, err := s.store.SetEncodedObject(o) - c.Assert(err, IsNil) - - hashes = append(hashes, hash) - - return err - - }) - c.Assert(err, IsNil) - _, err = s.enc.Encode(hashes) - c.Assert(err, IsNil) - - scanner = NewScanner(s.buf) - storage = memory.NewStorage() - d, err = NewDecoder(scanner, storage) - c.Assert(err, IsNil) - _, err = d.Decode() - c.Assert(err, IsNil) - - objIter, err = d.o.IterEncodedObjects(plumbing.AnyObject) - c.Assert(err, IsNil) - obtainedObjects := []plumbing.EncodedObject{} - err = objIter.ForEach(func(o plumbing.EncodedObject) error { - obtainedObjects = append(obtainedObjects, o) - - return nil - }) - c.Assert(err, IsNil) - c.Assert(len(obtainedObjects), Equals, len(objects)) - - equals := 0 - for _, oo := range obtainedObjects { - for _, o := range objects { - if o.Hash() == oo.Hash() { - equals++ - } - } - } - - c.Assert(len(obtainedObjects), Equals, equals) - }) -} - func (s *EncoderSuite) TestDecodeEncodeWithDeltaDecodeREF(c *C) { s.enc = NewEncoder(s.buf, s.store, true) s.simpleDeltaTest(c) |