aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format
Commit message (Collapse)AuthorAgeFilesLines
* plumbing: format/packfile, check nil objects in ObjectToPackJavi Fontan2018-01-252-8/+12
| | | | | | | 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-244-1/+51
| | | | | | | | | | | | 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>
* plumbing: packfile, Add crc check to scanner test.Javi Fontan2018-01-211-4/+75
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* plumbing: packfile, Add a buffer to crc writer.Javi Fontan2018-01-211-9/+31
| | | | | | | | | | | crc update with block smaller than 16 bytes uses a slower version of the function. ReadByte is heavily used by zlib inflate so most of the time crc is update byte by byte. A new Flush method is added to the scanner to flush this crc writer cache. It is only called when the Scanner reader is a teeReader. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Modify cache to delete more than one item to free spaceJavi Fontan2018-01-161-0/+2
| | | | | | | | | | | The previous version could only delete the oldest used object. If the object to cache was bigger than the space freed it could not be added. Also the decoder adds bases to the cache when they are needed. This change increases the speed creating indexes 2x. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Clean reconstructed objects outside pack windowJavi Fontan2018-01-111-13/+19
| | | | | | | | | | | Object walk reconstructs delta objects but these are not cleaned up after they got out the pack window. Without this change all reconstructed objects reside in memory. restoreOriginal call is moved before calling Size(). Now we can not guarantee that the object is already undeltified. Signed-off-by: Javi Fontan <javier@sourced.tech>
* fix typoWells Johnston2018-01-081-1/+1
|
* Merge pull request #698 from jfontan/improvement/use-decoder-cacheMáximo Cuadros2017-12-202-17/+39
|\ | | | | plumbing: cache, enforce the use of cache in packfile decoder
| * Make DeltaBaseCache privateJavi Fontan2017-12-201-6/+13
| | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| * Fix typo and documentation of NewDecoderForTypeJavi Fontan2017-12-201-3/+3
| | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| * Enforce the use of cache in packfile decoderJavi Fontan2017-12-202-12/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decoder object can make use of an object cache to speed up processing. Previously the only way to specify it was changing manually the struct generated by NewDecodeForFile. This lead to some instances to be created without it and penalized performance. Now the cache should be explicitly passed to the constructor function. NewDecoder now creates objects with a cache using the default size. A new helper function was added to create cache objects with the default size as this becomes a common task now: cache.NewObjectLRUDefault() Signed-off-by: Javi Fontan <jfontan@gmail.com>
* | Improve delta reutilizationAntonio Jesus Navarro Perez2017-12-205-29/+152
|/ | | | | | | | | | | - 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>
* format: diff, remove error when two files are empty, submodules are simply ↵Máximo Cuadros2017-12-072-5/+2
| | | | | | ignored Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* all: gofmt -sferhat elmas2017-11-303-3/+3
|
* all: simplificationferhat elmas2017-11-298-41/+15
| | | | | | | | | | - 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`
* update to go-billy.v4 and go-git-fixtures.v3Máximo Cuadros2017-11-239-13/+11
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* format: packfile fix DecodeObjectAt when Decoder has typeMáximo Cuadros2017-11-192-4/+29
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* Merge pull request #631 from keybase/strib/use-bytes-pool-for-diffsMáximo Cuadros2017-10-311-4/+13
|\ | | | | packfile: use buffer pool for diffs
| * packfile: use buffer pool for diffsJeremy Stribling2017-10-301-4/+13
| |
* | packfile: delete index maps from memory when no longer neededJeremy Stribling2017-10-301-0/+6
|/ | | | This helps keep memory usage stable while calculating deltas.
* config: support a configurable, and turn-off-able, pack.windowJeremy Stribling2017-09-115-37/+89
| | | | | | | | | | | | | | | | | | | | One use of go-git is to transfer git data from a non-standard git repo (not stored in a file system, for example) to a "remote" backed by a standard, local .git repo. In this scenario, delta compression is not needed to reduce transfer time over the "network", because there is no network. The underlying storage layer has already taken care of the data tranfer, and sending the objects to local .git storage doesn't require compression. So this PR gives the user the option to turn off compression when it isn't needed. Of course, this results in a larger, uncompressed local .git repo, but the user can then run git gc or git repack on that repo if they care about the storage costs. Turning the pack window to 0 on reduces total push time of a 36K repo by 50 seconds (out of a pre-PR total of 3m26s).
* plumbing/index: fix TestEncode in go 1.9Máximo Cuadros2017-09-071-1/+2
|
* packfile: small optimizations for findMatch and matchLengthMiguel Molina2017-09-072-16/+38
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: parallelize deltification of objects in groupsMiguel Molina2017-09-072-21/+31
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: use a modified version of JGit DeltaIndex and DeltaIndexScannerMiguel Molina2017-09-063-40/+286
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: slightly haster hash function for chunk-offset index keyMiguel Molina2017-09-062-11/+32
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: reuse delta indexes when possibleMiguel Molina2017-09-063-10/+22
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* packfile: improve performance a little by reducing gc pressureMiguel Molina2017-09-044-6/+33
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* plumbing: use sliding window in delta calculations, like git CLJeremy Stribling2017-08-282-1/+23
| | | | | | | | | | This sets a default sliding window of 10 for the delta calculation, just like git CL: https://git-scm.com/docs/git-pack-objects#git-pack-objects---windowltngt For a big-ish repo with 35K objects (17K commits), this reduced the time for calling `deltaSelection.walk` during a push from more than 14 minutes to about a minute.
* *: windows support, some more fixes (2) (#536)Manuel Carmona2017-08-071-0/+7
| | | | | | | | | | | | | | * fixed windows failed test: "143 FAIL: worktree_test.go:314: WorktreeSuite.TestFilenameNormalization" * fixed windows failed test: "489: FAIL: auth_method_test.go:106: SuiteCommon.TestNewSSHAgentAuthNoAgent" * fixed windows failed test: "279 FAIL: server_test.go:50: ServerSuite.TestClone" fixed windows failed test: "298 FAIL: server_test.go:37: ServerSuite.TestPush" * fixed windows failed test: "316 FAIL: <autogenerated>:26: UploadPackSuite.TearDownSuite" * fixed windows failed test: "FAIL: <autogenerated>:6: IndexSuite.TearDownSuite"
* Merge pull request #501 from smola/config-multiple-urlsMáximo Cuadros2017-08-025-13/+103
|\ | | | | config: multiple values in RemoteConfig (URLs and Fetch)
| * config: preserve option order on config marshallingSantiago M. Mola2017-08-015-12/+71
| | | | | | | | | | Do not change order of options (e.g. in RemoteConfig) when serializing for any option whose value has not changed.
| * format/config: add GoStringSantiago M. Mola2017-08-012-1/+32
| | | | | | | | This is more convenient for testing and debugging.
* | plumbing: add IsDelta method to ObjectTypeSantiago M. Mola2017-07-271-6/+2
| | | | | | | | | | ObjectType.IsDelta is a convenience function to match both offset and reference delta types.
* | storage: reuse deltas from packfilesSantiago M. Mola2017-07-275-98/+293
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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).
* | test: improve packfile.Encoder testsSantiago M. Mola2017-07-271-54/+68
|/ | | | | | | * Improve checks for encode/decode. * Make it easier to extend this test with more storage backends.
* storage/filesystem: reuse delta cacheSantiago M. Mola2017-07-271-10/+22
| | | | | Reuse delta base object cache for packfile decoders across multiple instances.
* plumbing/cache: use more explicit interfaceSantiago M. Mola2017-07-271-7/+6
| | | | | | * renamed Add to Put * Get returns a second bool value to indicate if there was hit or miss.
* format: idxfile, support for >2Gb packfilesMáximo Cuadros2017-07-274-1/+106
|
* packfile: create packfile.Index and reuse itSantiago M. Mola2017-07-269-93/+292
| | | | | | | | | | | | | | | There was an internal type (i.e. storage/filesystem.idx) to use as in-memory index for packfiles. This was not convenient to reuse in the packfile. This commit creates a new representation (format/packfile.Index) that can be converted to and from idxfile.Idxfile. A packfile.Index now contains the functionality that was scattered on storage/filesystem.idx and packfile.Decoder's internals. storage/filesystem now reuses packfile.Index instances and this also results in higher cache hit ratios when resolving deltas.
* Merge pull request #491 from smola/error-checksMáximo Cuadros2017-07-192-21/+22
|\ | | | | *: add more IO error checks
| * packfile: check close error in UpdateObjectStorageSantiago M. Mola2017-07-191-8/+14
| |
| * packfile: check zlib reader closing errorSantiago M. Mola2017-07-191-13/+8
| |
* | Merge pull request #493 from src-d/windowsMáximo Cuadros2017-07-191-1/+7
|\ \ | | | | | | *: several windows support fixes
| * | plumbing: format config, escape back slashMáximo Cuadros2017-07-192-4/+2
| | |
| * | worktree: commit, use path package instead of filepathMáximo Cuadros2017-07-192-2/+10
| |/
* / packfile: Avoid panics patching corrupted deltasAntonio Jesus Navarro Perez2017-07-192-16/+85
|/
* Use buffered IO for decoding index files.JP Sugarbroad2017-07-101-2/+3
| | | | This reduces syscall CPU time from >40% to <10% in my local repository.
* plumbing: gitignore, upgrade to go-billy.v3 and test with gocheckMáximo Cuadros2017-06-194-218/+199
|
* Merge pull request #429 from silvertern/gitignoreMáximo Cuadros2017-06-197-0/+676
|\ | | | | Adds .gitignore support