aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
Commit message (Collapse)AuthorAgeFilesLines
* *: Remove use of deprecated io/utilPaulo Gomes2023-05-114-11/+7
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* *: Remove redudant err nil checksPaulo Gomes2023-05-111-4/+1
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* plumbing: support SSH/X509 signed tagsHidde Beydals2023-02-274-32/+307
| | | | | | | | | | | | | | | | | | | | | | | | This commit enables support for extracting the SSH and X509 signatures from (annotated) Git tags, as an initial step to support the verification of more signatures than just PGP in go-git. The ported logic from Git further ensures that we look for a signature at the tail of an annotation, instead of the first signature we find in the annotation, as this could theoretically result in a faulty signature getting detected if part of a an annotation itself (e.g. by being placed in the middle as part of an inherited message). For commits, no further change is required as the current extraction of any signature (format) from `gpgsig` in the commit header is sufficient for manual verification. In a future iteration, we could add `signature/ssh` and `signature/x509` packages to further enable people to deal with verifying other signatures than PGP. As well as adding additional methods to `Commit` and `Tag` to provide glue between the packages and the most prominent user-facing APIs. Signed-off-by: Hidde Beydals <hidde@hhh.computer>
* Merge pull request #503 from jfontan/fix/similarity-matrix-too-bigMáximo Cuadros2022-11-171-1/+7
|\ | | | | plumbing: object, rename calculation uses too much memory
| * plumbing: object, rename calculation uses too much memoryJavi Fontan2022-03-301-1/+7
| | | | | | | | | | | | | | The size of the similarity matrix is not limited and can be quite big when lots of files are deleted and added in a commit. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* | Optimize zlib reader and consolidate sync.poolsPaulo Gomes2022-11-074-24/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | minor grammatical fixesJon Eskin2022-09-221-1/+1
|/
* Merge pull request #425 from abhinav/error-stringsMáximo Cuadros2021-12-111-2/+2
|\ | | | | error strings: Don't capitalize, use periods, or newlines
| * error strings: Don't capitalize, use periods, or newlinesAbhinav Gupta2021-12-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per [Go Code Review Comments][1], > Error strings should not be capitalized (unless beginning with proper > nouns or acronyms) or end with punctuation staticcheck's [ST1005][2] also complains about these. For example, ``` object_walker.go:63:10: error strings should not be capitalized (ST1005) object_walker.go:101:10: error strings should not be capitalized (ST1005) object_walker.go:101:10: error strings should not end with punctuation or a newline (ST1005) plumbing/format/commitgraph/file.go:17:26: error strings should not be capitalized (ST1005) ``` This fixes all instances of this issue reported by staticcheck. [1]: https://github.com/golang/go/wiki/CodeReviewComments#error-strings [2]: https://staticcheck.io/docs/checks/#ST1005
* | Merge pull request #418 from abhinav/unusedMáximo Cuadros2021-12-101-4/+0
|\ \ | | | | | | Remove unused vars/types/funcs/fields
| * | Remove unused variables/types/functionsAbhinav Gupta2021-11-271-4/+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-091-0/+4
|/ | | | | | | | | 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: object/patch, printStat strings.Repeat cause panic (#310) cookeem2021-05-121-2/+10
|
* plumbing: object, fix TestDecodeAndVerify testMáximo Cuadros2021-04-161-44/+53
|
* *: replace golang.org/x/crypto/openpgp by ↵Johan Fleury2021-04-064-89/+47
| | | | github.com/ProtonMail/go-crypto/openpgp (#283)
* Merge pull request #125 from cristaloleg/minor-linter-fixesMáximo Cuadros2020-07-161-1/+1
|\ | | | | *: minor linter fixes
| * Minor linter fixesOleg Kovalov2020-07-061-1/+1
| |
* | Use only one name for receiverOleg Kovalov2020-07-062-20/+20
|/
* fix nilOleg Kovalov2020-07-011-1/+1
|
* fix goreportcard warningsOleg Kovalov2020-07-017-13/+14
|
* plumbing: object, Commit.Patch support to as nilMáximo Cuadros2020-05-133-4/+27
|
* performed explicit conversions(needed)vashish12020-05-081-4/+4
|
* plumbing: exact renames detection could leave gaps in the changesMiguel Molina2020-05-042-8/+30
| | | | | | | | | This fixes an issue where exact renames detection could leave gaps with nil changes in the added and deleted change slices. That could lead to panics in the content rename detection and others if the user had set OnlyExact to true. Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* Merge pull request #49 from gopye/fix_patch_commentMáximo Cuadros2020-04-301-1/+1
|\ | | | | Remove unnecessary text from comment
| * Remove unnecessary text from commentgopye2020-04-291-1/+1
| |
* | Merge pull request #44 from tzneal/mine/fix-32-bit-buildMáximo Cuadros2020-04-301-1/+1
|\ \ | | | | | | fix 32 bit build
| * | fix 32 bit buildTodd Neal2020-04-271-1/+1
| |/ | | | | | | Discovered while building on a Raspberry Pi
* / Fix typo in comment of func TestCancelgopye2020-04-271-1/+1
|/
* plumbing: object, make renames diff defaultMáximo Cuadros2020-04-253-16/+55
|
* plumbing: detect renames by hash and similar content in diff treeMiguel Molina2020-04-234-4/+1374
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 go-git-fixtures/v4 and go-git/gcfgMáximo Cuadros2020-03-1014-34/+28
|
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-1037-122/+122
|
* Merge pull request #7 from dsymonds/masterMáximo Cuadros2020-03-101-2/+5
|\ | | | | plumbing/object: avoid O(N^2) string building when decoding commit message
| * plumbing/object: avoid O(N^2) string building when decoding commit messageDavid Symonds2020-03-101-2/+5
| | | | | | | | | | | | | | | | | | | | | | Most commits have relatively small messages, so this was never noticeable. However, there are some repositories that have semi-automated messages that can get very large (e.g. github.com/riscv/riscv-clang and its riscv-trunk branch), on the order of 109k lines. Changing from string += to using a bytes.Buffer reduces the time for Commit.Decode for that specific case from 35s to 74ms. Signed-off-by: David Symonds <dsymonds@golang.org>
* | Merge pull request #3 from go-git/pr-1248Máximo Cuadros2020-03-101-12/+24
|\ \ | | | | | | git.LogOptions: add `PathFilter func(string) bool`
| * | add NewCommitPathIterFromIter that accepts pathFilter func(string) boolSaeed Rasooli2019-11-291-12/+24
| |/ | | | | | | | | | | keep NewCommitFileIterFromIter for compatibilty for now Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* | hack to prevent codecov from adding more codepathsAndrew Thornton2020-02-231-6/+3
| | | | | | | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* | Fix date readingAndrew Thornton2020-02-231-7/+12
|/ | | | | | | | | | | | | | | | In the British TZ the following time: ``` 1579639200 +0100 ``` will be erroneously parsed as being with the GMT TZ. This leads to multiple errors with GPG validation. This PR fixes this by using the provided TZ information to create a FixedZone and sets that as the TZ Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix typos in comments, variables and function namesOleksandr Redko2019-10-243-8/+8
| | | | Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
* Add limiting options to git logknqyf2632019-08-041-0/+65
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* Remove elseknqyf2632019-08-041-1/+2
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* Handle io.EOF error in commitFileIter.ForEachknqyf2632019-08-031-1/+4
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* plumbing/object: don't assign err from ForEach loopChristian Muehlhaeuser2019-07-291-1/+1
| | | | | | | Since we don't check the value anyway, as it can't possibly be anything but nil. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 293e70fbceb5c81f33a96d5705f10785c6063db9)
* *: 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)
* *: added missing error checks in testsChristian Muehlhaeuser2019-07-291-0/+1
| | | | | | | | | | When we assign a value to err, make sure to also check for it being nil afterwards. If those were intentionally unchecked, we should remove the assignment in the first place. Those checks certainly never harm, but please review thoroughly and let me know. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 19d6f42a4d814a50bd262fbb69a9b670db9756a2)
* plumbing/object: simplify codeChristian Muehlhaeuser2019-07-291-8/+2
| | | | | | | | - Use append instead of ranged for loop - Simpler bool comparison Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 3918d0e1b73f5e59a8c93e2b5ae99295cef26cf9)
* Merge pull request #1097 from dpordomingo/merge-base-coreMáximo Cuadros2019-06-034-0/+971
|\ | | | | Create merge-base feature
| * Create merge-base featureDavid Pordomingo2019-06-034-0/+971
| | | | | | | | Signed-off-by: David Pordomingo <David.Pordomingo.F@gmail.com>
* | Add doc.go for commitgraph packagesFilip Navara2019-05-071-0/+7
| | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | Fix object/commitgraph testsFilip Navara2019-05-031-0/+3
| | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>