aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
Commit message (Collapse)AuthorAgeFilesLines
* utils: remove ioutil.Pipe and use std library io.PipeAyman Bagabas2023-11-132-3/+2
| | | | ioutil.Pipe literally calls io.Pipe.
* build: fix go-git binary buildAyman Bagabas2023-11-071-2/+2
|
* plumbing: format/packfile, Refactor patch deltaPaulo Gomes2023-11-062-113/+79
| | | | | | The changes aim to simplify the code and reduce duplication. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* Merge pull request #799 from pjbgf/perf2Paulo Gomes2023-11-062-50/+247
|\ | | | | plumbing: Optimise memory consumption for filesystem storage
| * plumbing: Optimise memory consumption for filesystem storagePaulo Gomes2023-10-282-50/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, as part of building the index representation, the resolveObject func would create an interim plumbing.MemoryObject, which would then be saved into storage via storage.SetEncodedObject. This meant that objects would be unnecessarily loaded into memory, to then be saved into disk. The changes streamlines this process by: - Introducing the LazyObjectWriter interface which enables the write operation to take places directly against the filesystem-based storage. - Leverage multi-writers to process the input data once, while targeting multiple writers (e.g. hasher and storage). An additional change relates to the caching of object info children within Parser.get. The cache is now skipped when a seekable filesystem is being used. The impact of the changes can be observed when using seekable filesystem storages, especially when cloning large repositories. The stats below were captured by adapting the BenchmarkPlainClone test to clone https://github.com/torvalds/linux.git: pkg: github.com/go-git/go-git/v5 cpu: Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz │ /tmp/old │ /tmp/new │ │ sec/op │ sec/op vs base │ PlainClone-16 41.68 ± 17% 48.04 ± 9% +15.27% (p=0.015 n=6) │ /tmp/old │ /tmp/new │ │ B/op │ B/op vs base │ PlainClone-16 1127.8Mi ± 7% 256.7Mi ± 50% -77.23% (p=0.002 n=6) │ /tmp/old │ /tmp/new │ │ allocs/op │ allocs/op vs base │ PlainClone-16 3.125M ± 0% 3.800M ± 0% +21.60% (p=0.002 n=6) Notice that on average the memory consumption per operation is over 75% smaller. The time per operation increased by 15%, which may actual be less on long running applications, due to the decreased GC pressure and the garbage collection costs. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | git: implement upload-server-info. Fixes #731Ayman Bagabas2023-11-032-0/+279
| | | | | | | | | | | | | | | | | | This adds UpdateServerInfo along with a new go-git command to generate info files to help git dumb http serve refs and their objects. This also updates the docs to reflect this. Docs: https://git-scm.com/docs/git-update-server-info Fixes: https://github.com/go-git/go-git/issues/731
* | plumbing: transport/ssh, Fix nil pointer dereference caused when an ↵Anand Francis Joseph2023-11-022-5/+27
|/ | | | | | unreachable proxy server is set. Fixes #900 Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com>
* plumbing: commitgraph, Add generation v2 supportAndrew Thornton2023-10-1215-55/+889
| | | | | | | | This PR adds in support for generation v2 support and a couple of new walkers to match --date-order etc options on log. This PR also fixes a bug in the chain code and adds more tests. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Merge pull request #866 from makkes/better-error-handlingPaulo Gomes2023-10-123-4/+124
|\ | | | | Improve handling of remote errors
| * plumbing: transport/common, Improve handling of remote errorsMax Jonas Werner2023-10-123-4/+124
| | | | | | | | | | | | | | | | | | | | | | Instead of simply returning the first line that the remote returned, go-git now actively searches all of stderr for lines that may contain a more actionable error message and returns that. In addition, this change adds a case to map the GitLab-specific error message to an ErrRepositoryNotFound error. Signed-off-by: Max Jonas Werner <mail@makk.es>
* | Merge pull request #868 from pjbgf/fix-fuzzPaulo Gomes2023-10-092-5/+34
|\ \ | | | | | | plumbing: protocol/packp, Add validation for decodeLine
| * | plumbing: protocol/packp, Add validation for decodeLinePaulo Gomes2023-10-072-5/+34
| |/ | | | | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* | Merge pull request #860 from enverbisevac/masterPaulo Gomes2023-10-082-0/+5
|\ \ | | | | | | add clone --shared feature
| * | git: clone --shared implementedenverbisevac2023-10-082-0/+5
| | |
* | | plumbing: commitgraph, fix types and handle commit-graph-chainsAndrew Thornton2023-10-0818-383/+1600
| |/ |/| | | | | | | | | | | | | | | Unfortunately the original variant makes some incorrect typing assumptions about commit-graphs which make handling graph chains difficult to do correctly. This creates a new subpackage and deprecates the old one. It then adds support commit graph chains. Signed-off-by: Andrew Thornton <art27@cantab.net>
* | Merge pull request #761 from liwenqiu/parse-commit-encoding-headerPaulo Gomes2023-10-042-4/+25
|\ \ | |/ |/| plumbing: parse the encoding header of the commit object
| * plumbing: parse the encoding header of the commit objectliwenqiu2023-10-042-4/+25
| | | | | | | | other part can re-code the commit message according to the encoding to this encoding info
* | Merge pull request #855 from 0x34d/fuzzingPaulo Gomes2023-10-036-0/+66
|\ \ | |/ |/| fuzzing : fuzz testing support for oss-fuzz integration
| * fuzzing : fuzz testing support for oss-fuzz integrationArjun Singh2023-10-026-0/+66
| | | | | | | | Signed-off-by: Arjun Singh <ajsinghyadav00@gmail.com>
* | plumbing: commitgraph, allow SHA256 commit-graphsAndrew Thornton2023-09-302-13/+31
|/ | | | | | | | Since the build-tag sha256 was introduced the commit graph code should be switched to use hash.Size and only use a graph if it has the correct hash version for the version of go-git that is built. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Merge pull request #836 from hezhizhen/typoPaulo Gomes2023-09-288-252/+252
|\ | | | | *: fix some typos
| * *: fix some typosZhizhen He2023-09-088-252/+252
| | | | | | | | Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
* | plumbing/object: Support mergetag in merge commitsAditya Sirish2023-09-272-0/+83
|/ | | | | | | | When a merge commit is created from merging a signed tag, the tag object is embedded in the commit object. This commit adds support for this tag data when encoding and decoding a commit object. Signed-off-by: Aditya Sirish <aditya@saky.in>
* plumbing: Do not swallow http message coming from VCS providers.matej.risek2023-09-054-4/+35
| | | | | | For diagnostics reasons we want to surface error messages coming from VCS providers. That's why we introduce the reason field to Err struct in http package. This field can be used by an end user of the library in order to better understand failures.
* plumbing: transport, handle IPv6 while parsing endpoint. Fixes #740merlin2023-07-262-1/+19
|
* *: Handle paths starting with ~usernameArieh Schneier2023-07-091-16/+2
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* plumbing: blame, Complete rewrite. Fixes #603Arieh Schneier2023-07-062-0/+81
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* plumbing: packp, A request is not empty if it contains shallows. Fixes #328Arieh Schneier2023-07-023-4/+11
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* plumbing: http, Fix empty repos on Git v2.41+Paulo Gomes2023-07-013-0/+22
| | | | | | | | | | | | Git v2.41.0 comes with [changes](https://github.com/git/git/commit/933e3a4ee205353d8f093d5dfcd226fa432c4e58) that breaks go-git's assumptions for when detecting empty repositories. Go-git expects a flush instead of the first hash line. Instead, a dummy capabilities^{} with zero-id is returned. The change aims to allow for identifying the object format even when cloning empty repositories. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* plumbing: gitignore, Allow gitconfig to contain a gitignore relative to any ↵Arieh Schneier2023-06-052-11/+57
| | | | | | user home. Fixes #578 Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* plumbing: gitignore, fix incorrect parsing. Fixes #500Arieh Schneier2023-05-292-6/+40
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* plumbing: gitignore, TypoJleagle2023-05-251-1/+1
| | | Co-authored-by: Paulo Gomes <paulo.gomes.uk@gmail.com>
* plumbing: gitignore, Allow gitconfig to contain a gitignore relative to user ↵Jleagle2023-05-252-0/+47
| | | | home
* git: enable fetch with unqualified referencesArieh Schneier2023-05-251-3/+4
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* Merge pull request #764 from techknowlogick/init-optionsPaulo Gomes2023-05-231-0/+1
|\ | | | | git: Allow Initial Branch to be configurable
| * git: Allow Initial Branch to be configurabletechknowlogick2023-05-211-0/+1
| |
* | *: 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>