diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2018-01-26 00:04:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-26 00:04:08 +0100 |
commit | 5d5b95168c9ed9f3210ddca5ce220fe3dbbebc0c (patch) | |
tree | 2b6ab08a4daf74c03cb5ae333554ed34f771095a /plumbing/format/packfile/encoder_test.go | |
parent | 8c24b1bf2ac5bdb1a1b624b9a80be17f0a4e685b (diff) | |
parent | d5f74d2d3cd63325c6d16f5e93f78d6462ec9308 (diff) | |
download | go-git-5d5b95168c9ed9f3210ddca5ce220fe3dbbebc0c.tar.gz |
Merge pull request #731 from jfontan/fix/crash-with-delta-cycles
plumbing: format/packfile, fix crash with cycle deltas
Diffstat (limited to 'plumbing/format/packfile/encoder_test.go')
-rw-r--r-- | plumbing/format/packfile/encoder_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/plumbing/format/packfile/encoder_test.go b/plumbing/format/packfile/encoder_test.go index 320036b..63dfafa 100644 --- a/plumbing/format/packfile/encoder_test.go +++ b/plumbing/format/packfile/encoder_test.go @@ -202,6 +202,15 @@ func (s *EncoderSuite) deltaOverDeltaCyclicTest(c *C) { o3 := newObject(plumbing.BlobObject, []byte("011111")) o4 := newObject(plumbing.BlobObject, []byte("01111100000")) + _, err := s.store.SetEncodedObject(o1) + c.Assert(err, IsNil) + _, err = s.store.SetEncodedObject(o2) + c.Assert(err, IsNil) + _, err = s.store.SetEncodedObject(o3) + c.Assert(err, IsNil) + _, err = s.store.SetEncodedObject(o4) + c.Assert(err, IsNil) + d2, err := GetDelta(o1, o2) c.Assert(err, IsNil) @@ -219,6 +228,18 @@ func (s *EncoderSuite) deltaOverDeltaCyclicTest(c *C) { pd3.SetDelta(pd4, d3) pd4.SetDelta(pd3, d4) + // SetOriginal is used by delta selector when generating ObjectToPack. + // It also fills type, hash and size values to be used when Original + // is nil. + po1.SetOriginal(po1.Original) + pd2.SetOriginal(pd2.Original) + pd2.SetOriginal(nil) + + pd3.SetOriginal(pd3.Original) + pd3.SetOriginal(nil) + + pd4.SetOriginal(pd4.Original) + encHash, err := s.enc.encode([]*ObjectToPack{ po1, pd2, |