aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
Commit message (Collapse)AuthorAgeFilesLines
* plumbing/packfile: add new packfile parserJavi Fontan2018-07-262-0/+498
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* plumbing/format/idxfile: add new Index and MemoryIndexMiguel Molina2018-07-198-339/+483
| | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* Merge pull request #885 from jsravn/findentry-return-file-not-foundMáximo Cuadros2018-07-162-3/+8
|\ | | | | plumbing: object, return ErrFileNotFound in FindEntry. Fixes #883
| * plumbing: object, expose ErrEntryNotFound in FindEntry. Fixes #883James Ravn2018-07-102-3/+8
| | | | | | | | | | | | | | | | | | FindEntry will return ErrDirNotFound if the directory doesn't exist. But it doesn't return a public error if the entry itself is missing. This exposes the internal error ErrEntryNotFound, so users can programmatically check for this condition. Signed-off-by: James Ravn <james@r-vn.org>
* | plumbing/transport/internal: common, add support of Gogs for ↵Jerome Doucet2018-07-142-0/+83
| | | | | | | | | | | | ErrRepositoryNotFound, avoiding to get an 'unknown error: '. Add some tests for existing supported services (github, gitlab, etc...) too. Signed-off-by: Jerome Doucet <jerdct@gmail.com>
* | plumbing: add context to allow cancel on diff/patch computingMarc Barussaud2018-07-027-9/+215
|/ | | | Signed-off-by: Marc Barussaud <marc.barussaud@orange.com>
* packfile: optimise NewIndexFromIdxFile for a very common caseDavid Symonds2018-06-211-2/+12
| | | | | | | Loading from an on-disk idxfile will usually already have the idxfile entries in order, so check that before wasting time on sorting. Signed-off-by: David Symonds <dsymonds@golang.org>
* plumbing/transport: http, Adds token authentication support [Fixes #858]Eric Billingsley2018-06-082-0/+38
| | | | Signed-off-by: Eric Billingsley <ebilling@babrains.com>
* plumbing: packfile, Don't push empty objects. Fixes #840kuba--2018-06-072-4/+19
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* plumbing: object, adds tree path cache to trees. Fixes #793Javi Fontan2018-06-061-1/+26
| | | | | | The cache is used in Tree.FindEntry for faster path search. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Merge pull request #846 from dsymonds/compactMáximo Cuadros2018-06-062-23/+67
|\ | | | | packfile: improve Index memory representation to be more compact
| * packfile: improve Index memory representation to be more compactDavid Symonds2018-05-302-23/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using a map for offset indexing, use a sorted slice. Binary searching is fast, and a slice is much more compact. This has a negligible hit on speed, but has a significant impact on memory usage, especially for larger repos. benchmark old ns/op new ns/op delta BenchmarkIndexConstruction-12 15506506 14056098 -9.35% benchmark old allocs new allocs delta BenchmarkIndexConstruction-12 60764 60385 -0.62% benchmark old bytes new bytes delta BenchmarkIndexConstruction-12 4318145 3913169 -9.38% Signed-off-by: David Symonds <dsymonds@golang.org>
* | Remove printlnAntonio Jesus Navarro Perez2018-06-051-1/+0
| | | | | | | | Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
* | idxfile: optimise allocations in readObjectNamesDavid Symonds2018-05-301-4/+4
|/ | | | | | | This makes all the required Entry allocations in one go, instead of huge amounts of small individual allocations. Signed-off-by: David Symonds <dsymonds@golang.org>
* Worktree: Provide ability to add excludes (#825)Alan D. Cabrera2018-05-112-7/+249
| | | Worktree: Provide ability to add excludes
* plumbing: format: pktline, Accept oversized pkt-lines up to 65524 bytesJoseph Vusich2018-04-023-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | The canonical Git client successfully decodes sideband packets up to 65524 bytes in length (4-byte header + 65520-byte payload). The Git protocol documentation was updated in August 2016 to reduce the maximum payload size to 65516 bytes, however old implementations still exist in the wild emitting 65520-byte payloads. As there is no technical difficulty with accepting (not emitting) larger payload sizes, this change adjusts the limit check to allow successful decoding of packets up to 65524 bytes. This change increases compatibility with the current canonical Git implementation. Doc changes from August 2016: https://github.com/git/git/commit/7841c4801ce51f1f62d376d164372e8677c6bc94#diff-52695c8fe91b78b70cea44562ae28297L67 Current packet buffer size is still LARGE_PACKET_MAX (+1 null): https://github.com/git/git/blob/468165c1d8a442994a825f3684528361727cd8c0/sideband.c#L24 https://github.com/git/git/blob/468165c1d8a442994a825f3684528361727cd8c0/sideband.c#L36 LARGE_PACKET_MAX definition: https://github.com/git/git/blob/468165c1d8a442994a825f3684528361727cd8c0/pkt-line.h#L100 Signed-off-by: Joseph Vusich <jvusich@amazon.com>
* Merge pull request #792 from ajnavarro/fix/support-no-symref-capabilityMáximo Cuadros2018-04-022-9/+172
|\ | | | | Resolve HEAD if symRefs capability is not supported
| * Resolve HEAD if symRefs capability is not supportedAntonio Jesus Navarro Perez2018-03-262-9/+172
| | | | | | | | Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
* | plumbing: transport, make target repo writeable in testsJavi Fontan2018-03-271-0/+21
| | | | | | | | | | | | | | | | | | Some tests write to an already existent repository retrieved from fixtures. The permissions of these files are read only and make receive pack fail. This was shadowed before as close errors were lost. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* | *: Use CheckClose with named returnsJavi Fontan2018-03-278-14/+15
|/ | | | | | | | Previously some close errors were losts. This is specially problematic in go-git as lots of work is done here like generating indexes and moving packfiles. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* *: skip time consuming testsMáximo Cuadros2018-03-211-0/+9
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* add tests for NewCommitIterCTime and NewCommitIterBSFSaeed Rasooli2018-03-061-0/+96
| | | | Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* add LogOrder, LogOptions.Order, implement Order=LogOrderCommitterTime and ↵Saeed Rasooli2018-03-052-0/+203
| | | | | | Order=LogOrderBSF Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* Merge pull request #762 from zkry/escape-basic-auth-user-pswdMáximo Cuadros2018-03-012-2/+12
|\ | | | | plubming: transport, Escape the user and pswd for endpoint. Fixes #723
| * plubming: transport, Escape the user and password for endpoint. Fixes #723Zachary Romero2018-02-282-2/+12
| | | | | | | | Signed-off-by: Zachary Romero <zacromero3@gmail.com>
* | Merge pull request #766 from mvdan/patchesMáximo Cuadros2018-03-014-70/+11
|\ \ | | | | | | Unused params, unused code, make Go tip's vet happy
| * | all: make the upcoming Go 1.11's vet happyDaniel Martí2018-03-011-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vet in 1.10 and earlier was buggy in how its "composite literal uses unkeyed fields" check had false negatives when it encountered a slice of pointer types that omitted each element's type. This has been fixed in tip, so adapt to that fix. Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
| * | all: remove some unused codeDaniel Martí2018-03-013-59/+0
| |/ | | | | | | Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
* | Merge pull request #739 from mcuadros/addMáximo Cuadros2018-02-283-0/+255
|\ \ | | | | | | new methods Worktree.[AddGlob|RemoveBlob] and recursive Worktree.[Add|Remove]
| * | plumbing: format index, Index.Add and Index.Glob methodsMáximo Cuadros2018-02-263-0/+255
| | | | | | | | | | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* | | Return error when creating public keys from invalid PEMMark DeLillo2018-02-252-0/+9
| |/ |/| | | | | | | | | * pem.Decode will return nil in this case, and passing that to x509.IsEncryptedBlock will cause it to panic Signed-off-by: Mark DeLillo <github.med@delillo.org>
* | Merge pull request #749 from irias/masterv4.1.1Máximo Cuadros2018-02-172-2/+43
|\ \ | | | | | | plumbing: diff, fix crash when a small ending equal-chunk
| * | add test for crashing diffMechiel Lukkien2018-02-161-0/+37
| | | | | | | | | | | | | | | | | | | | | this reuses an existing patch, setting context to 6 triggers the bug, becuase of a 5-line trailing equals chunk. Signed-off-by: Mechiel Lukkien <mechiel@ueber.net>
| * | fix crash when generating a unified diff with a small ending equal-chunkMechiel Lukkien2018-02-141-2/+6
| | | | | | | | | | | | Signed-off-by: Mechiel Lukkien <mechiel@ueber.net>
* | | Merge pull request #751 from mcuadros/redirectMáximo Cuadros2018-02-154-10/+56
|\ \ \ | |/ / |/| | transport: http, fix services redirecting only info/refs
| * | transport: http, fix services redirecting only info/refsMáximo Cuadros2018-02-144-10/+56
| |/ | | | | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* | plumbing: format/packfile, add SaveOriginalMetadata functionJavi Fontan2018-02-092-5/+9
| | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* | plumbing: format/packfile, fix panic retrieving object hash.Javi Fontan2018-02-093-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix mistypingDmitry Labutin2018-02-071-2/+2
|/ | | | Signed-off-by: Dmitry Labutin <dmitry@labutin.com>
* Merge pull request #731 from jfontan/fix/crash-with-delta-cyclesMáximo Cuadros2018-01-264-2/+56
|\ | | | | plumbing: format/packfile, fix crash with cycle deltas
| * 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>
* | gofmt -sMáximo Cuadros2018-01-251-2/+2
|/ | | | Signed-off-by: Máximo Cuadros <mcuadros@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>
* Test eviction of more than one objectJavi Fontan2018-01-161-0/+20
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Cache should hold objects the same size as MaxSizeJavi Fontan2018-01-161-1/+1
| | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Modify cache to delete more than one item to free spaceJavi Fontan2018-01-162-5/+3
| | | | | | | | | | | 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
|