diff options
author | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2017-12-18 18:11:38 +0100 |
---|---|---|
committer | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2017-12-20 12:06:36 +0100 |
commit | c932bd462fed2ff470d9ff40f15102237a3287f8 (patch) | |
tree | 49aecd1f4d1f356f5f482f5d9eaa801c3907ef37 /plumbing/format/packfile/encoder_advanced_test.go | |
parent | fbe632ef8d41c17caa76b6ed3f1d404e1f047299 (diff) | |
download | go-git-c932bd462fed2ff470d9ff40f15102237a3287f8.tar.gz |
Improve delta reutilization
- Remove wrong 'if' on delta selector that causes poor delta reutilizations
- packfile.Encoder now can write deltas and objects in a non specific order
- ObjectToPack now saves the Offset on the packfile to be able to obtain base
offset in a recursive manner and write them before the delta itself
- Added encoder test to check cyclic delta chains
- Check the output packfile hash in all encoder tests
Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
Diffstat (limited to 'plumbing/format/packfile/encoder_advanced_test.go')
-rw-r--r-- | plumbing/format/packfile/encoder_advanced_test.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plumbing/format/packfile/encoder_advanced_test.go b/plumbing/format/packfile/encoder_advanced_test.go index 69d6b39..1075875 100644 --- a/plumbing/format/packfile/encoder_advanced_test.go +++ b/plumbing/format/packfile/encoder_advanced_test.go @@ -68,16 +68,18 @@ func (s *EncoderAdvancedSuite) testEncodeDecode(c *C, storage storer.Storer, pac buf := bytes.NewBuffer(nil) enc := NewEncoder(buf, storage, false) - _, err = enc.Encode(hashes, packWindow) + encodeHash, err := enc.Encode(hashes, packWindow) c.Assert(err, IsNil) scanner := NewScanner(buf) storage = memory.NewStorage() d, err := NewDecoder(scanner, storage) c.Assert(err, IsNil) - _, err = d.Decode() + decodeHash, err := d.Decode() c.Assert(err, IsNil) + c.Assert(encodeHash, Equals, decodeHash) + objIter, err = storage.IterEncodedObjects(plumbing.AnyObject) c.Assert(err, IsNil) obtainedObjects := map[plumbing.Hash]bool{} |