aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/diff_delta.go
Commit message (Collapse)AuthorAgeFilesLines
* plumbing: format/packfile, Fix data race and resource leak.Ed Bardsley2019-06-031-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two problems are fixed: - Buffers are not returned to the pool in the case of errors. - Per https://golang.org/pkg/bytes/#Buffer.Bytes, the slice returned from bytes.Buffer.Bytes() is only valid until the next modification of the buffer, so it must be copied before the buffer is returned to the pool. Running `go test -race` detected the following: ``` ================== WARNING: DATA RACE Write at 0x00c000224020 by goroutine 15: bytes.(*Buffer).WriteByte() /usr/local/Cellar/go/1.11.5/libexec/src/bytes/buffer.go:271 +0xc8 vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.diffDelta() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/diff_delta.go:95 +0x505 vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.getDelta() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/diff_delta.go:60 +0x4ae vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*deltaSelector).tryToDeltify() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/delta_selector.go:309 +0x398 vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*deltaSelector).walk() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/delta_selector.go:262 +0x33b vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*deltaSelector).ObjectsToPack.func1() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/delta_selector.go:70 +0x6a Previous read at 0x00c000224020 by goroutine 8: runtime.slicecopy() /usr/local/Cellar/go/1.11.5/libexec/src/runtime/slice.go:221 +0x0 vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.getDelta() vendor/gopkg.in/src-d/go-git.v4/plumbing/memory.go:53 +0x5e2 vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*deltaSelector).tryToDeltify() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/delta_selector.go:309 +0x398 vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*deltaSelector).walk() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/delta_selector.go:262 +0x33b vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*deltaSelector).ObjectsToPack.func1() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/delta_selector.go:70 +0x6a Goroutine 15 (running) created at: vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*deltaSelector).ObjectsToPack() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/delta_selector.go:69 +0x761 vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Encoder).Encode() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/encoder.go:52 +0xb1 vendor/gopkg.in/src-d/go-git%2ev4.pushHashes.func1() vendor/gopkg.in/src-d/go-git.v4/remote.go:1026 +0x102 Goroutine 8 (finished) created at: vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*deltaSelector).ObjectsToPack() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/delta_selector.go:69 +0x761 vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Encoder).Encode() vendor/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/encoder.go:52 +0xb1 vendor/gopkg.in/src-d/go-git%2ev4.pushHashes.func1() vendor/gopkg.in/src-d/go-git.v4/remote.go:1026 +0x102 ================== ``` Signed-off-by: Ed Bardsley <ewb@uber.com>
* plumbing: packfile, Don't push empty objects. Fixes #840kuba--2018-06-071-1/+1
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* packfile: use buffer pool for diffsJeremy Stribling2017-10-301-4/+13
|
* packfile: small optimizations for findMatch and matchLengthMiguel Molina2017-09-071-16/+15
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: parallelize deltification of objects in groupsMiguel Molina2017-09-071-20/+0
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: use a modified version of JGit DeltaIndex and DeltaIndexScannerMiguel Molina2017-09-061-37/+7
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: slightly haster hash function for chunk-offset index keyMiguel Molina2017-09-061-9/+30
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: reuse delta indexes when possibleMiguel Molina2017-09-061-5/+12
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: improve performance a little by reducing gc pressureMiguel Molina2017-09-041-3/+9
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: A copy operation cannot be bigger than 64kbAntonio Jesus Navarro Perez2017-06-011-1/+18
| | | | More info here: https://github.com/git/git/blob/f7466e94375b3be27f229c78873f0acf8301c0a5/diff-delta.c#L428
* format/packfile: improve binary delta algorithmAntonio Jesus Navarro Perez2017-05-241-44/+94
| | | | Implemented algorithm described in "File System Support for Delta Compression" paper, from "Joshua P. MacDonald".
* project: move imports from srcd.works to gopkg.inAntonio Jesus Navarro Perez2017-03-071-1/+1
| | | | To be able to fix #261 we will move again to gopkg.in before v4 stable release.
* plumbing: improve documentation (Fix #242)Antonio Jesus Navarro Perez2017-02-231-2/+4
|
* new srcd.works/go-git.v4 pathMáximo Cuadros2017-01-301-1/+1
|
* Fix some typos in plumbing docs (#244)Sergio Arbeo2017-01-301-1/+1
|
* packfile: delta selection logic (#182)Antonio Navarro Perez2016-12-161-18/+3
| | | | | | | | | | * packfile: delta selection logic - Implemented logic to assign deltas to objects * Requested changes * Improved tests and fix errors
* move plumbing from top level package to plumbing (#183)Santiago M. Mola2016-12-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * plumbing: rename Object -> EncodedObject. * plumbing/storer: rename ObjectStorer -> EncodedObjectStorer. * move difftree to plumbing/difftree. * move diff -> utils/diff * make Object/Tag/Blob/Tree/Commit/File depend on storer. * Object and its implementations now depend only on storer.EncodedObjectStorer, not git.Repository. * Tests are decoupled accordingly. * move Object/Commit/File/Tag/Tree to plumbing/object. * move Object/Commit/File/Tag/Tree to plumbing/object. * move checkClose to utils/ioutil. * move RevListObjects to plumbing/revlist.Objects. * move DiffTree to plumbing/difftree package. * rename files with plural nouns to singular * plumbing/object: add GetBlob/GetCommit/GetTag/GetTree.
* packfile: improve delta copy operation encoding code (#186)Antonio Navarro Perez2016-12-141-31/+13
|
* format/packfile: implement delta encoding (#172)Antonio Navarro Perez2016-12-141-7/+33
| | | | | | | | | | | | * format/packfile: implement delta encoding - Added all the logic to the encoder to be able to encode ref-delta and offset-delta objects - Created plumbing.ObjectToPack to handle deltas and standard objects when we are writting them into a packfile - Added specific encoder delta tests, one standard object and one delta, and one standard object and two deltas * Requested changes. * Requested changes
* packfile: delta diff implementation (#159)Antonio Navarro Perez2016-12-091-0/+147
* packfile: delta diff implementation - Renamed delta.go to patch_delta.go - Added diff_delta.go file - Added tests that creates a diff and then tries to patch it * Requested changes