aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
Commit message (Collapse)AuthorAgeFilesLines
* *: fetch, adds the prune option. Fixes #316Julien Salleyron2024-02-221-0/+114
| | | | Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
* git: remote, flip branch check to not-tag checkAditya Sirish2023-10-261-0/+141
| | | | | | | | | | 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-1/+1
| | | | Signed-off-by: Zhizhen He <hezhizhen.yi@gmail.com>
* git: enable fetch with unqualified referencesArieh Schneier2023-05-251-0/+56
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* git: Fix fetching after shallow clone. Fixes #305Arieh Schneier2023-05-241-41/+68
| | | | Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
* *: Remove use of deprecated io/utilPaulo Gomes2023-05-111-2/+1
| | | | Signed-off-by: Paulo Gomes <pjbgf@linux.com>
* git: Add support to ls-remote with peeled references. Fixes #749Paulo Gomes2023-05-031-0/+37
| | | | | | | | | | | | | | | 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>
* 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>
* Merge pull request #418 from abhinav/unusedMáximo Cuadros2021-12-101-1/+1
|\ | | | | Remove unused vars/types/funcs/fields
| * 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.
* | Add ForceWithLease Push OptionJohn Cai2021-11-021-0/+127
|/ | | | | | | | --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 support to push commits per hashesThibault Jamet2021-10-281-0/+92
| | | | | | | | | | | | | | 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-0/+12
|\ | | | | Remote: add RemoteURL to {Fetch,Pull,Push}Options
| * add testsNorwin2021-09-281-0/+12
| |
* | git: add --follow-tags option for pushesJohn Cai2021-10-051-0/+60
|/ | | | This PR adds support for the --follow-tags option for pushes.
* git: Add support for deepening shallow clones (#311)Marcus Watkins2021-05-121-0/+26
|
* *: use go-billy instead of os callsMáximo Cuadros2021-05-021-30/+58
|
* Remote: new ListContext function (#278)Xiang Xiujuan2021-04-211-0/+11
|
* plumbing: wire up contexts for Transport.AdvertisedReferences (#246)Andrew Suffield2021-03-261-2/+47
| | | | | * plumbing: wire up contexts for Transport.AdvertisedReferences * add more tests for context wiring
* add RequireRemoteRefs to PushOptions (#258)Andrew Suffield2021-03-251-0/+53
| | | | | | | | | | | | | | | | | | 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.
* Fetch should return a unique error type when ref not foundandrew2nelson2020-09-021-0/+2
| | | | | | | | | 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-0/+25
|
* Remote.Push: support force optionkappyhappy2020-05-211-0/+28
|
* Remote.Fetch: support exact SHA1 refspecsMáximo Cuadros2020-05-111-1/+30
|
* *: migration from go-git-fixtures/v4 and go-git/gcfgMáximo Cuadros2020-03-101-1/+1
|
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-101-11/+11
|
* Merge pull request #1165 from seletskiy/push-pruneMáximo Cuadros2019-07-261-1/+58
|\ | | | | Remote: add Prune option to PushOptions
| * add Prune option to PushOptionsStanislav Seletskiy2019-07-251-1/+58
| | | | | | | | Signed-off-by: Stanislav Seletskiy <s.seletskiy@gmail.com>
* | git : allows to create a Remote without a RepositoryValentin Cocaud2019-06-171-32/+32
|/ | | | Signed-off-by: Valentin Cocaud <v.cocaud@gmail.com>
* git: fix goroutine block while pushing a remoteJavi Fontan2019-03-011-0/+9
| | | | | | | | | On session.ReceivePack error the gororutine doing the encoding got blocked either writing objects to the pipe or sending error to the done channel. The problem did not cause a perceived problem but left blocked goroutines. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* remote: use reference deltas on push when the remote server does notBenjamin Ash2018-10-161-0/+23
| | | | | | support offset deltas Signed-off-by: Benjamin Ash <bash@intelerad.com>
* Expose Storage cache.kuba--2018-09-071-22/+13
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* Remote.Fetch: error on missing remote referenceMáximo Cuadros2018-06-211-0/+14
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* git: remote, Add shallow commits instead of substituting. Fixes #412Javi Fontan2018-04-161-0/+52
| | | | | | | | | | updateShallow substituted the previous shallow list with the one returned by the UploadPackResponse. If the repository had previous shallow commits these are deleted from the list. This change adds the new shallow hashes to the old ones. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* dotgit: add CheckAndSetReference testsJeremy Stribling2017-11-281-2/+19
|
* remote: add test for non-force, fast-forward fetchingJeremy Stribling2017-11-271-0/+42
|
* all: fixes for ineffective assignferhat elmas2017-11-261-0/+3
|
* update to go-billy.v4 and go-git-fixtures.v3Máximo Cuadros2017-11-231-2/+2
| | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* remote: add the last 100 commits for each ref in haves listJeremy Stribling2017-10-051-1/+5
| | | | | | | | | | | | | If the local ref is not an ancestor of the remote ref being fetched, then when we send an UploadPack request with that local ref as one of the Haves, the remote will not recognize it, and will think we are asking for the entire history of the repo, even if there's a common ancestor. To do this right, we need to support the multi-ack protocol so we can negotiate a common commit. That's hard though; this is a quick fix just to include the previous 100 commits for each local ref in the Haves list, and hope that one of them is the common commit.
* Merge pull request #609 from darkowlzz/ls-remoteMáximo Cuadros2017-10-041-0/+31
|\ | | | | remote: add support for ls-remote
| * TestList: explicitly check the refs in fixtureSunny2017-10-041-27/+21
| |
| * Create ListOptions and rename LSRemote to List.Sunny2017-10-041-5/+3
| |
| * remote: add support for ls-remoteSunny2017-10-021-0/+39
| |
* | remote: iterate over reference only onceMiguel Molina2017-09-051-13/+15
|/ | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* Remote.Fetch Tags logic improvement and fix NoTagsMáximo Cuadros2017-09-041-1/+1
|
* remote: avoid expensive revlist operation when only deleting refsJeremy Stribling2017-08-281-0/+36
|
* Merge pull request #531 from mcuadros/ref-nameMáximo Cuadros2017-08-021-1/+1
|\ | | | | plumbing: moved `Reference.Is*` methods to `ReferenceName.Is*`
| * *: use the new API for ReferenceName.Is* methodsMáximo Cuadros2017-08-021-1/+1
| |
* | config: multiple values in RemoteConfig (URLs and Fetch)Santiago M. Mola2017-08-011-28/+27
|/ | | | | | | | * Change `URL string` to `URL []string` in `RemoteConfig`, since git allows multiple URLs per remote. See: http://marc.info/?l=git&m=116231242118202&w=2 * Fix marshalling of multiple fetch refspecs.
* *: package context support in Repository, Remote and SubmoduleMáximo Cuadros2017-07-261-0/+41
|