aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/object_pack.go
Commit message (Collapse)AuthorAgeFilesLines
* plumbing: format/packfile, add SaveOriginalMetadata functionJavi Fontan2018-02-091-4/+8
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* plumbing: format/packfile, fix panic retrieving object hash.Javi Fontan2018-02-091-0/+5
| | | | | | | | | | | | | | | | In some cases the original data is not saved before it is cleaned and forces a panic when it's needed. The change adds ObjectToPack.CleanOriginal to be used to clean original object instead of: object.Original = nil Now when the Original data is freed because it's no longer in the pack window a SetOriginal call is done to make sure that Size, Hash and Size data is not lost. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* plumbing: format/packfile, check nil objects in ObjectToPackJavi Fontan2018-01-251-6/+10
| | | | | | | SetOriginal now skips setting resolved values if the provided object is nil. BackToOriginal also skips nil Original objects. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* plumbing: format/packfile, fix crash with cycle deltasJavi Fontan2018-01-241-0/+27
| | | | | | | | | | | | Resolving cycles relied on ObjectToPack objects having Original. This is no longer true with the changes from #720. This commit changes: * Save original type, hash and size in ObjectToPack * Use SetObject to set both Original and resolved type, hash and size * Restore original object before using BackToOriginal (cycle resolution) * Update encoder test to check this case Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Improve delta reutilizationAntonio Jesus Navarro Perez2017-12-201-1/+31
| | | | | | | | | | | - 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>
* all: simplificationferhat elmas2017-11-291-5/+1
| | | | | | | | | | - no length for map initialization - don't check for boolean/error return - don't format string - use string method of bytes buffer instead of converting bytes to string - use `strings.Contains` instead of `strings.Index` - use `bytes.Equal` instead of `bytes.Compare`
* storage: reuse deltas from packfilesSantiago M. Mola2017-07-271-1/+45
| | | | | | | | | | | | | | | | | | | * plumbing: add DeltaObject interface for EncodedObjects that are deltas and hold additional information about them, such as the hash of the base object. * plumbing/storer: add DeltaObjectStorer interface for object storers that can return DeltaObject. Note that calls to EncodedObject will never return instances of DeltaObject. That requires explicit calls to DeltaObject. * storage/filesystem: implement DeltaObjectStorer interface. * plumbing/packfile: packfile encoder now supports reusing deltas that are already computed (e.g. from an existing packfile) if the storage implements DeltaObjectStorer. Reusing deltas boosts performance of packfile generation (e.g. on push).
* 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.
* new srcd.works/go-git.v4 pathMáximo Cuadros2017-01-301-1/+1
|
* packfile: delta selection logic (#182)Antonio Navarro Perez2016-12-161-0/+6
| | | | | | | | | | * 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-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* format/packfile: implement delta encoding (#172)Antonio Navarro Perez2016-12-141-0/+47
* 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