aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
Commit message (Collapse)AuthorAgeFilesLines
* git: Implement Merge function with initial FastForwardMerge supportPaulo Gomes2024-03-091-1/+1
| | | | | | | | | | | | Introduces the Merge function for merging branches in the codebase. Currently, the function only supports FastForwardMerge strategy, meaning it can efficiently update the target branch pointer if the source branch history is a linear descendant. Support for additional merge strategies (e.g., three-way merge) will be added in future commits. Signed-off-by: Paulo Gomes <paulo.gomes@suse.com>
* *: fetch, adds the prune option. Fixes #316Julien Salleyron2024-02-221-1/+30
| | | | Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
* git: stop iterating at oldest shallow when pulling. Fixes #305Dan Hoizner2023-11-271-5/+18
|
* plumbing: fix empty uploadpack request errorAyman Bagabas2023-11-161-0/+4
| | | | | | | | | | If we have all what we asked for, finish the session and handle error. This is equivalent of git "Already up to date." message. Fixes: https://github.com/go-git/go-git/issues/328 Fixes: https://github.com/go-git/go-git/issues/638 Fixes: https://github.com/go-git/go-git/issues/157
* utils: remove ioutil.Pipe and use std library io.PipeAyman Bagabas2023-11-131-1/+1
| | | | ioutil.Pipe literally calls io.Pipe.
* git: remote, flip branch check to not-tag checkAditya Sirish2023-10-261-3/+3
| | | | | | | | | | In remote.updateLocalReferenceStorage, this commit updates a check to see if the reference is for a branch (in refs/heads) to checking the reference is not a tag. This change ensures that the subsequent fast-forward only handling clauses apply to references that are not standard branches stored in refs/heads. Signed-off-by: Aditya Sirish <aditya@saky.in>
* *: fix some typosZhizhen He2023-09-081-3/+3
| | | | Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
* plumbing: http, Fix empty repos on Git v2.41+Paulo Gomes2023-07-011-4/+5
| | | | | | | | | | | | 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>
* Merge pull request #763 from AriehSchneier/dont-add-want-if-havePaulo Gomes2023-05-291-4/+8
|\ | | | | git: don't add to wants if exists, shallow and depth 1
| * git: don't add to wants if exists, shallow and depth 1Arieh Schneier2023-05-251-4/+8
| | | | | | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* | git: enable fetch with unqualified referencesArieh Schneier2023-05-251-33/+48
|/ | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* git: Fix fetching after shallow clone. Fixes #305Arieh Schneier2023-05-241-3/+13
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* Merge pull request #753 from andrewpollock/add_list_timeoutPaulo Gomes2023-05-201-1/+9
|\ | | | | git: remote, add support for a configurable timeout.
| * git: remote, add support for a configurable timeout.Andrew Pollock2023-05-121-1/+9
| | | | | | | | | | | | | | The previous hard-coded 10 second value is too short for listing large repositories like https://gitlab.com/gitlab-org/gitlab Return an error on nonsensical subzero timeout values
* | *: Remove redudant err nil checksPaulo Gomes2023-05-111-5/+1
|/ | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* plumbing/transport: add ProxyOptions to specify proxy detailsSanskar Jaiswal2023-05-041-8/+9
| | | | Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
* git: Add support to ls-remote with peeled references. Fixes #749Paulo Gomes2023-05-031-6/+23
| | | | | | | | | | | | | | | A new PeelingOption field was introduced into ListOptions. The new options include the default (and backwards compatible) IgnorePeeled. Plus another two variations which either only returns peeled references (OnlyPeeled), or append peeled references to the list (AppendPeeled). The ls-remote example was updated to align with upstream, in which peeled references are appended to the results by default. A new ErrEmptyUrls error is now returned when List or ListContext do not receive a URL to work with, to improve overall execution flow. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* 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-5/+2
|\ \ | | | | | | 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.
| * | Remove unused variables/types/functionsAbhinav Gupta2021-11-271-1/+1
| |/ | | | | | | | | | | | | | | [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 branch 'master' into jc-push-atomicMáximo Cuadros2021-12-101-6/+38
|\ \
| * | Add ForceWithLease Push OptionJohn Cai2021-11-021-6/+37
| |/ | | | | | | | | | | | | | | --force-with-lease allows a push to force push with some safety measures. If the ref on the remote is what we expect, then the force push is allowed to happen. See https://git-scm.com/docs/git-push#Documentation/git-push.txt---force-with-leaseltrefnamegt for more information
* / Add Atomic to push optionsJohn Cai2021-11-031-0/+4
|/ | | | | | push --atomic allows a push to succeed or fail atomically. If one ref fails, the whole push fails. This commit allows the user to set Atomic as an option for a push.
* Merge pull request #399 from S-Bohn/add-push-optionsMáximo Cuadros2021-11-011-0/+7
|\ | | | | Remote: PushOptions add push-options
| * plumbing: packp, Add encoding for push-options. Fixes #268.Sören Bohn2021-10-261-0/+7
| | | | | | | | go-git: Add field `Options` to `PushOptions`, wire functionality.
* | Add support to push commits per hashesThibault Jamet2021-10-281-0/+41
|/ | | | | | | | | | | | | | Using plain git, the command `git push ${sha}:refs/heads/some-branch` actually ensures that the remote branch `some-branch` points to the commit `${sha}`. In the current version of go-git, this results in an "everything is up to date" error. When a source reference is not found, check the object storage to find the sha. If it is found, consider pushing this exact commit. fixes: #105
* Merge pull request #375 from noerw/add-remoteurl-optionMáximo Cuadros2021-10-261-4/+13
|\ | | | | Remote: add RemoteURL to {Fetch,Pull,Push}Options
| * Add RemoteURL to {Fetch,Pull,Push}OptionsNorwin2021-09-151-4/+13
| | | | | | | | | | Can be used to override the URL to operate on: RemoteName will be ignored for the actual fetch
* | git: add --follow-tags option for pushesJohn Cai2021-10-051-0/+78
|/ | | | This PR adds support for the --follow-tags option for pushes.
* remote: patch default timeout for `List` (#321)v5.4.1Nicolas Chagrass2021-05-241-1/+1
| | | It looks a test value was shipped breaking a lot of the usage of the library.
* git: Add support for deepening shallow clones (#311)Marcus Watkins2021-05-121-1/+43
|
* utils: ioutil, Pipe implementatioMáximo Cuadros2021-05-021-1/+1
|
* Remote: new ListContext function (#278)Xiang Xiujuan2021-04-211-1/+19
|
* Minor doc fixes (#287)Jeff Widman2021-04-161-2/+2
|
* plumbing: wire up contexts for Transport.AdvertisedReferences (#246)Andrew Suffield2021-03-261-3/+3
| | | | | * plumbing: wire up contexts for Transport.AdvertisedReferences * add more tests for context wiring
* add RequireRemoteRefs to PushOptions (#258)Andrew Suffield2021-03-251-0/+34
| | | | | | | | | | | | | | | | | | The git protocol itself uses a compare-and-swap mechanism, where changes send the old and new values and the change is only applied if the old value matches. This is used to implement the --force-with-lease feature in git push. go-git populates the `old` field with the current value of the ref that is read from the remote. We can implement a convenient (albeit more limited) form of the --force-with-lease feature just by allowing the caller to specify particular values for this ref. Callers can then implement complex multi-step atomic operations by reading the ref themselves at the start of the process, and passing to in RequireRemoteRefs at the end. This is also a suitable building block for implementing --force-with-lease (#101), which is mostly an exercise in computing the correct hash to require. Hence, this appears to be the most reasonable API to expose.
* Add insecureSkipTLS and cabundle (#228)Daishan Peng2021-01-271-8/+10
| | | | | This PR add insecureSkipTLSVerify and cabundle to any remote http calls so that https repo with private CA signed can be used. This is the equivalent of https.sslVerify and GIT_SSL_CAINFO
* Fetch should return a unique error type when ref not foundandrew2nelson2020-09-021-1/+14
| | | | | | | | | It can be useful for callers to distinguish between an error of "couldn't find remote ref" and some other error like "network error". Creating an explicit error type for this allows consumers to determine the kind of error using the errors.Is and errors.As interface added in go1.13
* git: remote, Fix deleting references when force pushing.Chris Gavin2020-08-281-1/+1
|
* Merge pull request #125 from cristaloleg/minor-linter-fixesMáximo Cuadros2020-07-161-6/+3
|\ | | | | *: minor linter fixes
| * fix slice capacityOleg Kovalov2020-07-071-1/+1
| |
| * Minor linter fixesOleg Kovalov2020-07-061-6/+3
| |
* | Skip error check explicitlyOleg Kovalov2020-07-061-4/+6
|/
* Remote.Push: support force optionkappyhappy2020-05-211-0/+9
|
* Remote.Fetch: support exact SHA1 refspecsMáximo Cuadros2020-05-111-1/+32
|
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-101-17/+17
|
* *: fixed tautological error conditionsautological error conditionsChristian Muehlhaeuser2019-07-291-1/+1
| | | | | | | | | | - Added missing error handling around encodeCommitData and prevented shadowing err. - Removed tautological error checks. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 7d76176416551fc21d98bc17768d158a82281406)
* Merge pull request #1165 from seletskiy/push-pruneMáximo Cuadros2019-07-261-15/+52
|\ | | | | Remote: add Prune option to PushOptions