aboutsummaryrefslogtreecommitdiffstats
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
* utils: merkletrie, Align error message with upstreamPaulo Gomes2024-07-132-0/+20
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* utils: update comment in node.go's Hash()Alexander Block2024-01-101-0/+4
| | | | This reflects the lazy hash calculation and the implications of this.
* Merge pull request #825 from candid82/masterPaulo Gomes2024-01-101-39/+37
|\ | | | | Calculate filesystem node's hash lazily.
| * utils: filesystem, Calculate filesystem node's hash lazily.Roman Bataev2023-08-211-39/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The main motivation behind this change is to speed up status operation. Currently it's very slow, especially for repositories with lots of ignored files (e.g. node.js repository with node_modules directory). One of the reasons for this slowness is the fact that traversing filesystem involves calculating file hashes for all files, even if those hashes are not needed in the end because the files are in gitignore. On my machine, for a random repository with sizable (ignored) node_modules directory this changes bring the execution time for Worktree.Status from ~3.5s to ~1.4s. This is still very slow, but a significant improvement. A better fix (instead of or in addition to this one) would be to avoid traversing ignored files in the first place. However, such change seem to be more intrusive and will require much deeper understanding of the codebase.
* | Merge pull request #930 from steiler/fixSocketsPaulo Gomes2023-11-202-0/+30
|\ \ | | | | | | Ignore ModeSocket files
| * | utils: merkletrie, Skip loading sockets as filesystem nodes. Fixes #312steiler2023-11-192-0/+30
| |/
* | utils: move trace to utilsAyman Bagabas2023-11-162-0/+150
| | | | | | | | | | | | | | Without exposing `trace`, we can't set a target to enable tracing from out of go-git. Fixes: https://github.com/go-git/go-git/pull/916
* | utils: remove ioutil.Pipe and use std library io.PipeAyman Bagabas2023-11-133-29/+1
| | | | | | | | ioutil.Pipe literally calls io.Pipe.
* | [fuzzing] cifuzz, update fuzzers, bug fixArjun Singh2023-10-061-9/+0
| | | | | | | | Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
* | fuzzing : fuzz testing support for oss-fuzz integrationArjun Singh2023-10-021-0/+9
| | | | | | | | Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
* | *: fix some typosZhizhen He2023-09-083-3/+3
|/ | | | Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
* *: Remove use of deprecated io/utilPaulo Gomes2023-05-111-4/+4
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* Optimize zlib reader and consolidate sync.poolsPaulo Gomes2022-11-076-0/+303
| | | | | | | | | | | | | | | | | | | Expands on the optimisations from https://github.com/fluxcd/go-git/pull/5 and ensures that zlib reader does not need to recreate a deflate dictionary at every use. The use of sync pools was consolidated into a new sync utils package. name old time/op new time/op delta Parser-16 7.51ms ± 3% 7.71ms ± 6% ~ (p=0.222 n=5+5) name old alloc/op new alloc/op delta Parser-16 4.65MB ± 3% 1.90MB ± 3% -59.06% (p=0.008 n=5+5) name old allocs/op new allocs/op delta Parser-16 3.48k ± 0% 3.32k ± 0% -4.57% (p=0.016 n=5+4) Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* Merge pull request #418 from abhinav/unusedMáximo Cuadros2021-12-101-14/+0
|\ | | | | Remove unused vars/types/funcs/fields
| * Remove unused variables/types/functionsAbhinav Gupta2021-11-271-14/+0
| | | | | | | | | | | | | | | | [staticcheck](https://staticcheck.io/) reported a number of unused fields, functions, types, and variables across the code. Where possible, use them (assert unchecked errors in tests, for example) and otherwise remove them.
* | simplified sparse checkoutJohn Cai2021-11-098-3/+55
|/ | | | | | | | | This is the initial logic to support a simple sparse checkout where directories to be included can be specified in CheckoutOptions. This change doesn't fully support the sparse patterns, nor does this change include the optimization to collapse flie entries in ithe index that are excluded via the sparse checkout directory patterns included under the parent directory.
* plumbing: format/packfile, prevent large objects from being read into memory ↵zeripath2021-06-301-0/+40
| | | | | | | | | | | | | | | completely (#330) This PR adds code to prevent large objects from being read into memory from packfiles or the filesystem. Objects greater than 1Mb are now no longer directly stored in the cache or read completely into memory. This PR differs and improves the previous broken #323 by fixing several bugs in the reader and transparently wrapping ReaderAt as a Reader. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Revert "plumbing: format/packfile, prevent large objects from being read ↵v5.4.2zeripath2021-06-021-22/+0
| | | | | into memory completely (#303)" (#329) This reverts commit 720c192831a890d0a36b4c6720b60411fa4a0159.
* plumbing: format/packfile, prevent large objects from being read into memory ↵v5.4.0zeripath2021-05-121-0/+22
| | | | | | | | | | | completely (#303) This PR adds code to prevent large objects from being read into memory from packfiles or the filesystem. Objects greater than 1Mb are now no longer directly stored in the cache or read completely into memory. Signed-off-by: Andrew Thornton <art27@cantab.net>
* utils: ioutil, Pipe implementatioMáximo Cuadros2021-05-023-1/+29
|
* Dont skip errorOleg Kovalov2020-07-061-2/+1
|
* fix nilOleg Kovalov2020-07-011-3/+4
|
* fix goreportcard warningsOleg Kovalov2020-07-013-3/+5
|
* plumbing: detect renames by hash and similar content in diff treeMiguel Molina2020-04-231-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements the rename detection algorithms used in the JGit implementation. Given a list of changes, additions and deletions are extracted and matched in two ways: - By exact hash content: all additions and deletions are grouped by the content hash and paired with the best match based on the file mode and file path. All the files that cannot be paired are kept as regular deletions and additions. - By similar content: a matrix of addition and deletion pairs with all possible combinations is created and scored by how similar the content is between both files as well as how similar the file path is. The pairs with the best score and whose score is equal or greater than a threshold are paired and turned into a rename. All the files that cannot be paired are kept as regular deletions and additions. DiffTree and DiffTreeContext will not return the changes with renames detected for compatibility reasons, although this will change in v6 so that detecting renames is the default behaviour. A new function DiffTreeWithOptions has been added to configure the parameters for the rename detection to control the score threshold, the limit of renames and whether to use similar content detection in the detection. More information: - https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java - https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java - https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-1022-40/+40
|
* Fix typos in comments, variables and function namesOleksandr Redko2019-10-246-12/+12
| | | | Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
* format: diff, Handle no newline at end of file. Fixes #936Stuart Jansen2019-10-131-0/+31
| | | | Signed-off-by: Stuart Jansen <sjansen@buscaluz.org>
* *: avoid unnecessary conversionsChristian Muehlhaeuser2019-07-292-3/+3
| | | | | | | No need to convert these values, they're already of the right type. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit a1d8a7ac8bd0e4aff0f27dbb8bb37b8bd13a1346)
* utils: binary reader, add ReadUntilFromBufioReader()Arran Walker2019-04-222-6/+22
| | | | Signed-off-by: Arran Walker <arran.walker@fiveturns.org>
* plumbing: format/index perf, buffered reads, reflection removalArran Walker2019-04-211-0/+9
| | | | | | | | | | Large performance increase by buffering reads. There were a few instances where binary.Read() would end up using reflection on &plumbing.Hash, rather than treating it as a byte slice. This has now been resolved. Signed-off-by: Arran Walker <arran.walker@fiveturns.org>
* Add diff.DoWithTimeout()Vadim Markovtsev2019-03-131-2/+16
| | | | Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
* Increase diffmatchcpatch timeoutVadim Markovtsev2019-03-101-0/+2
| | | | | | Fixes https://github.com/src-d/go-git/issues/1083 Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
* Remove Unicode normalization in difftreeVadim Markovtsev2019-02-113-10/+31
| | | | | | Fixes #1057 Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
* Merge pull request #874 from smola/patchcontextv4.5.0Máximo Cuadros2018-07-102-0/+82
|\ | | | | plumbing: add context to allow cancel on diff/patch computing
| * plumbing: add context to allow cancel on diff/patch computingMarc Barussaud2018-07-022-0/+82
| | | | | | | | Signed-off-by: Marc Barussaud <marc.barussaud@orange.com>
* | utils: diff, skip useless rune->string conversionMarc Barussaud2018-06-261-2/+2
|/ | | | | | | According to library documentation : https://github.com/sergi/go-diff/blob/master/diffmatchpatch/diff.go#L391 Signed-off-by: Marc Barussaud <marc.barussaud@orange.com>
* update to go-billy.v4 and go-git-fixtures.v3Máximo Cuadros2017-11-232-3/+4
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* examples,plumbing,utils: typo fixesferhat elmas2017-11-204-7/+7
|
* utils: merkletrie, filesystem fix symlinks to dirMáximo Cuadros2017-11-201-0/+36
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* Fix support for dir symlinksDmitry Frank2017-11-101-0/+4
|
* worktree: normalized string comparison testsMáximo Cuadros2017-08-021-1/+11
|
* Normalize filenames before comparing.Josh Betz2017-07-311-1/+7
| | | | | | | | | Some multibyte characters can have multiple representations. Before comparing strings, we need to normalize them. In this case we're normalizing to normalized form C, but it shouldn't matter as long as both strings are normalized to the same form. Fixes https://github.com/src-d/go-git/issues/495
* format: idxfile, support for >2Gb packfilesMáximo Cuadros2017-07-272-1/+17
|
* ioutil: Context and OnError helpersMáximo Cuadros2017-07-252-1/+197
|
* utils: merkletrie filesystem based on path, and not in filepathMáximo Cuadros2017-07-193-14/+14
|
* utils: merkletrie fix test on windowsMáximo Cuadros2017-07-182-16/+23
|
* remote: fix Worktree.Status on empty repositoryMáximo Cuadros2017-07-132-2/+13
|
* utils: merkletrie support for symlinksMáximo Cuadros2017-06-182-6/+54
|
* *: upgrade to go-billy.v3, mergeMáximo Cuadros2017-06-182-5/+5
|
* format/diff: unified diff encoder and public APIAntonio Jesus Navarro Perez2017-05-232-0/+55
| | | | | | | | | - Added Patch interface - Added a Unified Diff encoder from Patches - Added Change method to generate Patches - Added Changes method to generate Patches - Added Tree method to generate Patches - Added Commit method to generate Patches