aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
Commit message (Collapse)AuthorAgeFilesLines
...
* | *: Add missing error checksPaulo Gomes2023-05-112-14/+24
| | | | | | | | | | | | | | | | Some areas of the code base were missing error checks, without them it may be harder to troubleshoot unexpected behaviours. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | *: Replace fmt.Sprintf with net.JoinHostPortPaulo Gomes2023-05-112-4/+5
| | | | | | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | *: Remove use of deprecated io/utilPaulo Gomes2023-05-1132-93/+66
| | | | | | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | *: Remove redudant err nil checksPaulo Gomes2023-05-113-13/+3
|/ | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* plumbing: transport/http, add support for custom proxy URLsSanskar Jaiswal2023-05-047-1/+307
| | | | | | | | | | | | | | Add support for custom HTTP and HTTPS proxies for each session. The tests require server certificate and a matching private key to be able to run a TLS server and test HTTPS proxy functionality. The cert and the key are stored in `plumbing/transport/http/testdata/certs` and were generated using the following command: `openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt` Note: All details were left empty, except for the FQDN for which example.com was used. Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
* plumbing: transport/http, refactor transport to cache underlying transport ↵Sanskar Jaiswal2023-05-046-45/+230
| | | | | | | | | | | | | objects Refactor the in-built http transport to cache the underlying http transport objects mapped to its specific options for each Git transport object. This lets us reuse the transport for a specific set of configurations as recommended. (ref: https://pkg.go.dev/net/http#Transport) If there are no transport specific options provided, the default transport is used. Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
* plumbing: transport/ssh, add support for custom proxy URLsSanskar Jaiswal2023-05-045-14/+287
| | | | Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
* plumbing/transport: add ProxyOptions to specify proxy detailsSanskar Jaiswal2023-05-041-0/+31
| | | | Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
* Merge pull request #743 from fcharlie/improve-packed-refsPaulo Gomes2023-04-261-1/+1
|\ | | | | storage: filesystem/dotgit, Improve load packed-refs
| * storage: filesystem/dotgit, Improve load packed-refsForce Charlie2023-04-251-1/+1
| |
* | Merge pull request #715 from jotadrilo/fix/csp-likePaulo Gomes2023-04-171-4/+16
|\ \ | |/ |/| internal: Fix regression in scp-like match
| * internal: Fix regression in csp-like matchJoseda Rios2023-04-151-4/+16
| | | | | | | | Signed-off-by: Joseda Rios <josriolop@gmail.com>
* | Merge pull request #707 from pjbgf/experimental-sha256Paulo Gomes2023-04-1115-31/+117
|\ \ | | | | | | *: Add support for initializing SHA256 repositories
| * | *: Support variable length plumbing.HashPaulo Gomes2023-03-0811-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The variable length for plumbing.Hash is defined at build time, blocked by tag sha256. This approach was a trade-off between keeping backwards compatibility while making progress towards supporting SHA256 with a small amount of changes. Relates to the SHA256 implementation, defined in #706. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
| * | config: Add Repository Format ExtensionPaulo Gomes2023-03-081-0/+53
| | | | | | | | | | | | | | | | | | Relates to the SHA256 implementation, defined in #706. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
| * | plumbing/hash: Add SHA256 as a supported algorithmPaulo Gomes2023-03-073-0/+33
| |/ | | | | | | | | | | Relates to #706. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* / plumbing: resolve non-external delta referencesZauberNerd2023-03-232-0/+22
|/ | | | | | | | | | | In a self-contained pack file delta references might point to base objects stored later in the file. In this case we need to replace placeholders for external refs with the actual base object and update the children references. Fixes: #484 Co-authored-by: Markus Wolf <mail@markus-wolf.de>
* Merge pull request #655 from aymanbagabas/hostkeycallbackPaulo Gomes2023-03-064-43/+101
|\ | | | | fix(ssh): unable to pass a custom HostKeyCallback func
| * fix(ssh): unable to pass a custom HostKeyCallback funcAyman Bagabas2023-03-054-43/+101
| | | | | | | | | | | | | | | | Don't overwrite HostKeyCallback if one is provided. Fixes: c35b8082c863 ("plumbing: transport/ssh, auto-populate ClientConfig.HostKeyAlgorithms. Fixes #411") Fixes: https://github.com/go-git/go-git/issues/654 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
* | Merge pull request #682 from ThinkChaos/fix/transport-empty-unknown-errPaulo Gomes2023-03-022-1/+15
|\ \ | | | | | | fix: don't use the `firstErrLine` when it is empty
| * | fix: don't use the `firstErrLine` when it is emptyThinkChaos2023-02-212-1/+15
| |/ | | | | | | | | Returning `nil` causes `handleAdvRefDecodeError` to fall back to `io.ErrUnexpectedEOF`.
* | Merge pull request #690 from hiddeco/recognize-tag-signaturesv5.6.0Máximo Cuadros2023-02-284-32/+307
|\ \ | | | | | | plumbing: support SSH/X509 signed tags
| * | 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>
* / Remove need to build with CGOPaulo Gomes2023-02-251-4/+2
|/ | | | | | | | | | | | Follow-up from #618, at the time the Pure Go sha1cd implementation was not performant enough to be the default. This has now changed and the cgo and generic implementations yields similar results. Users are able to override the default implementation, however this seems to be a better default as it does not require the use of CGO during build time. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* sha1: Add collision resistent implementationPaulo Gomes2022-11-258-17/+181
| | | | | | | | | | | | | | | | | | | 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
| | |
* | | Allow unsupported multi_ack capabilityPaulo Gomes2022-11-164-12/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Optimize zlib reader and consolidate sync.poolsPaulo Gomes2022-11-0712-141/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | 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-074-9/+53
|/ / / | | | | | | | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | | *: fix some typos (#567)cui fliter2022-09-221-1/+1
| | | | | | | | | | | | | | | 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-222-17/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #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-225-10/+10
| | |
* | | all: replace go-homedir with os.UserHomeDirDaniel Martí2022-05-291-5/+6
| | | | | | | | | | | | 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.
* | plumbing: protocol/pakp, update agent Carlos Alexandro Becker2022-01-194-5/+5
| | | | | | Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
* | remove packfile and align to test fixturespaul.t2022-01-052-3/+2
| |
* | Merge branch 'master' into codecommit-ref-deltapaul.t2021-12-1521-86/+99
|\ \