aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* .github: update go versionMáximo Cuadros2022-11-291-3/+3
|
* Merge pull request #618 from fluxcd/collision_detectionMáximo Cuadros2022-11-2910-17/+184
|\ | | | | sha1: Add collision resistent implementation
| * sha1: Add collision resistent implementationPaulo Gomes2022-11-2510-17/+184
|/ | | | | | | | | | | | | | | | | | | Implement the same SHA1 collision resistent algorithm used by both the Git CLI and libgit2. Only commits with input that match the unavoidable bit conditions will be further processed, which will result in different hashes. Which is the same behaviour experienced in the Git CLI and Libgit2. Users can override the hash algorithm used with: hash.RegisterHash(crypto.SHA1, sha1.New) xref links: https://github.com/libgit2/libgit2/pull/4136/commits/2dfd1294f7a694bfa9e864a9489ae3cb318a5ed0 https://github.com/git/git/commit/28dc98e343ca4eb370a29ceec4c19beac9b5c01e Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* 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>
* | Merge pull request #354 from dowy/issue/#309-clone-branch-with-hash-in-nameMáximo Cuadros2022-11-172-6/+46
|\ \ | | | | | | plumbing: config, Branch name with hash can be cloned. Fixes #309
| * | plumbing: config, fix broken unit testsAdrian Pronk2021-07-261-3/+13
| | |
| * | plumbing: config, support correct escaping as per git-config rulesAdrian Pronk2021-07-252-13/+25
| | |
| * | plumbing: config, remove duplicated character in setAdrian Pronk2021-07-241-1/+1
| | |
| * | plumbing: config, Branch name with hash can be cloned. Fixes #309Adrian Pronk2021-07-242-1/+19
| | |
* | | Merge pull request #613 from fluxcd/unsupportedMáximo Cuadros2022-11-165-12/+97
|\ \ \ | | | | | | | | Allow unsupported `multi_ack` capability
| * | | Allow unsupported multi_ack capabilityPaulo Gomes2022-11-165-12/+97
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Azure DevOps requires capabilities multi_ack / multi_ack_detailed, which are not fully implemented and by default are included in transport.UnsupportedCapabilities. The initial clone operations require a full download of the repository, and therefore those unsupported capabilities are not as crucial, so by removing them from that list allows for the first clone to work successfully. Additional fetches will yield issues, therefore to support that repository users have to work from a clean clone until those capabilities are fully supported. Commits and pushes back into the repository have also been tested and work fine. This change adds an example for cloning Azure DevOps repositories. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | | Merge pull request #586 from blmayer/patch-1Miguel Molina2022-11-071-5/+5
|\ \ \ | | | | | | | | Fixed some little typos
| * | | Fixed some little typosBrian Mayer2022-09-271-5/+5
| | | |
* | | | Merge pull request #598 from To1ne/toon-fix-gitattr-crashMáximo Cuadros2022-11-072-0/+11
|\ \ \ \ | | | | | | | | | | plumbing: gitattributes, Avoid index out of range
| * | | | plumbing: gitattributes, Avoid index out of rangeToon Claes2022-10-122-0/+11
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a path is deeper than the single asterisk pattern the code would crash with a "index out of range". This change checks the length of the remaining pattern before it references an element of that slice. With a single trailing asterisk paths deeper than the pattern should not get the attributes. For example with the following `.gitattributes` file: thirdparty/* linguist-vendored This is how git handles it: $ git check-attr --all thirdparty/README.md thirdparty/README.md: diff: markdown thirdparty/README.md: linguist-vendored: set $ git check-attr --all thirdparty/package/README.md thirdparty/package/README.md: diff: markdown
* | | | Merge pull request #608 from pjbgf/optimise-zlib-readerMáximo Cuadros2022-11-0720-161/+417
|\ \ \ \ | | | | | | | | | | Optimise zlib reader and consolidate sync.Pools
| * | | | tests: Replace time.sleep with eventuallyPaulo Gomes2022-11-071-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous approach was intermittently flake, leading to different results based on external results. The check for goroutines numbers now checks for less or equal, as the goal of the assertion is to confirm no goroutine is being leaked. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
| * | | | Optimize zlib reader and consolidate sync.poolsPaulo Gomes2022-11-0719-153/+398
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #602 from pjbgf/parse-optimisationMáximo Cuadros2022-11-078-16/+111
|\| | | | | |/ / / |/| | | Parse optimisations
| * | | Optimise Reference.String()Paulo Gomes2022-11-072-3/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decreases allocations and bytes per operation by using string builder with a predefined size. One additional allocation has been removed by using its own implementation of Strings(). The reason behind this was due to the fact the calls to .String() are more recurrent than .Strings() and the performance impact was worth the code duplication. Benchmark results: cpu: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz name old time/op new time/op delta ReferenceStringSymbolic-16 140ns ± 4% 40ns ± 9% -71.19% (p=0.008 n=5+5) ReferenceStringHash-16 174ns ±14% 85ns ± 4% -51.13% (p=0.008 n=5+5) ReferenceStringInvalid-16 48.9ns ± 2% 1.5ns ± 3% -96.96% (p=0.008 n=5+5) name old alloc/op new alloc/op delta ReferenceStringSymbolic-16 88.0B ± 0% 32.0B ± 0% -63.64% (p=0.008 n=5+5) ReferenceStringHash-16 176B ± 0% 144B ± 0% -18.18% (p=0.008 n=5+5) ReferenceStringInvalid-16 0.00B 0.00B ~ (all equal) name old allocs/op new allocs/op delta ReferenceStringSymbolic-16 4.00 ± 0% 1.00 ± 0% -75.00% (p=0.008 n=5+5) ReferenceStringHash-16 5.00 ± 0% 3.00 ± 0% -40.00% (p=0.008 n=5+5) ReferenceStringInvalid-16 0.00 0.00 ~ (all equal) Signed-off-by: Paulo Gomes <pjbgf@linux.com>
| * | | Use Sync.Pool pointers to optimise memory usagePaulo Gomes2022-11-076-13/+71
|/ / / | | | | | | | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | | *: fix typographical errorJames Romeril2022-09-221-1/+1
| | |
* | | *: fix some typos (#567)cui fliter2022-09-222-3/+3
| | | | | | | | | | | | | | | Signed-off-by: cui fliter <imcusg@gmail.com> Signed-off-by: cui fliter <imcusg@gmail.com>
* | | Fix typos (#532)Quanyi Ma2022-09-221-2/+2
| | |
* | | plumbing: packp and server, Include the contents of ↵🚀 Steven Ewing 🌌2022-09-225-5/+40
| | | | | | | | | | | | `GO_GIT_USER_AGENT_EXTRA` as the git user agent. Fixes #529
* | | plumbing: transport/ssh, auto-populate ClientConfig.HostKeyAlgorithms. Fixes ↵Evan Elias2022-09-224-25/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #411 This commit adjusts the transport/ssh logic in command.connect(), so that it now auto-populates ssh.ClientConfig.HostKeyAlgorithms. The algorithms are chosen based on the known host keys for the target host, as obtained from the known_hosts file. In order to look-up the algorithms from the known_hosts file, external module github.com/skeema/knownhosts is used. This package is just a thin wrapper around golang.org/x/crypto/ssh/knownhosts, adding an extra mechanism to query the known_hosts keys, implemented in a way which avoids duplication of any golang.org/x/crypto/ssh/knownhosts logic. Because HostKeyAlgorithms vary by target host, some related logic for setting HostKeyCallback has been moved out of the various AuthMethod implementations. This was necessary because the old HostKeyCallbackHelper is not host-specific. Since known_hosts handling isn't really tied to AuthMethod anyway, it seems reasonable to separate these. Previously-exported types/methods remain in place for backwards compat, but some of them are now unused. For testing approach, see pull request. Issue #411 can only be reproduced via end-to-end / integration testing, since it requires actually launching an SSH connection, in order to see the key mismatch error triggered from https://github.com/golang/go/issues/29286 as the root cause.
* | | minor grammatical fixesJon Eskin2022-09-227-12/+12
| | |
* | | all: replace go-homedir with os.UserHomeDirDaniel Martí2022-05-294-12/+7
| | | | | | | | | | | | Added in Go 1.12, this means we need one less dependency.
* | | plumbing: packp, Avoid duplicate encoding when overriding a Capability ↵Tyler Christensen2022-05-012-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | value. (#521) Previously, calling `Set($CAPABILITY, ...)` on a `capability.List` where `$CAPABILITY` was already present would correctly replace the existing value of that capability, but would also result in that capability being listed twice in the internal `l.sort` slice. This manifested publicly when the `List` was encoded as the same capability appearing twice with the same value in the encoded output.
* | | Worktree: use syscall.Timespec.Unix #437 Tobias Klauser2022-04-093-3/+3
| |/ |/| | | | | Use the syscall method instead of repeating the type conversions for the syscall.Stat_t Atim/Atimespec/Ctim members.
* | Merge pull request #475 from michenriksen/revision-fix-endless-loopMáximo Cuadros2022-02-242-2/+9
|\ \ | | | | | | revision: fix endless looping in revision parser
| * | revision: fix endless looping in revision parserMichael Henriksen2022-02-192-2/+9
|/ / | | | | | | | | | | | | | | | | | | | | Fixes a bug in the revision parser which caused an endless loop when parsing revisions with opening braces "{" but no closing braces "}". Example bad revisions: - ^{/ - ~@{ - @@{{0
* | Repository: don't crash accessing invalid pathinfo (#443)Christian Muehlhaeuser2022-01-192-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | When fs.Stat returns an error, pathinfo may be nil. In such situations the only safe response seems to be to return the error to the caller. Without this fix, accessing pathinfo.IsDir() below would lead to a crash dereferencing a nil pointer. This crash can be reproduced by trying to initialize a Git repo with an invalid path name. Also see: https://github.com/muesli/gitty/issues/36
* | plumbing: protocol/pakp, update agent Carlos Alexandro Becker2022-01-194-5/+5
| | | | | | Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
* | pumbling: packfile, resolve external reference deltaMáximo Cuadros2022-01-085-4/+30
|\ \ | | | | | | fix: resolve external reference delta
| * | remove packfile and align to test fixturespaul.t2022-01-055-7/+8
| | |
| * | Merge branch 'master' into codecommit-ref-deltapaul.t2021-12-1550-155/+496
| |\ \
| | * \ Merge branch 'go-git:master' into masterPaul T2021-12-1556-191/+958
| | |\ \ | |_|/ / |/| | |
* | | | Merge pull request #425 from abhinav/error-stringsMáximo Cuadros2021-12-1112-19/+19
|\ \ \ \ | | | | | | | | | | error strings: Don't capitalize, use periods, or newlines
| * | | | Fix repository_testAbhinav Gupta2021-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | The test verifies the exact error message.
| * | | | error strings: Don't capitalize, use periods, or newlinesAbhinav Gupta2021-12-0411-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1022-94/+14
|\ \ \ \ \ | | | | | | | | | | | | Remove unused vars/types/funcs/fields
| * | | | | remote/addReachableTags: Remove guard before deleteAbhinav Gupta2021-11-271-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The membership check before attempting to `delete` from the `tags` map is unnecessary because the operation is a no-op if the item does not already exist in the map.
| * | | | | transactional/ReferenceStorage: Drop packRefs fieldAbhinav Gupta2021-11-271-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The packRefs field is unused. It is assigned to true from the `PackRefs()` method, but because the method is not on the pointer type, the assignment has no effect. var st ReferenceStorage fmt.Println(st.packRefs) // false st.PackRefs() fmt.Println(st.packRefs) // false Delete the unused field.
| * | | | | storage/transactional: Use correct config in testAbhinav Gupta2021-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `cfg` loaded from `cs.Config` was unused. It looks like this assertion intended to validate that, not `temporalCfg`, which was already checked above this block.
| * | | | | Remove unused variables/types/functionsAbhinav Gupta2021-11-2720-85/+12
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [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.
* | | | | Merge pull request #406 from john-cai/jc-push-atomicMáximo Cuadros2021-12-103-0/+26
|\ \ \ \ \ | | | | | | | | | | | | Remote: Push, add atomic to push options
| * \ \ \ \ Merge branch 'master' into jc-push-atomicMáximo Cuadros2021-12-1025-42/+438
| |\ \ \ \ \ | |/ / / / / |/| | | | |
* | | | | | Merge pull request #410 from john-cai/jc-sparseMáximo Cuadros2021-12-1014-10/+160
|\ \ \ \ \ \ | | | | | | | | | | | | | | Worktree: Checkout, simplified sparse checkout