diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2021-10-26 12:31:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 12:31:59 +0200 |
commit | 99457e570d34320b12fb4fcd0f054f3d0b1d3eec (patch) | |
tree | 37d000185d7335402e0a2be17f46203e535a3b0b /remote_test.go | |
parent | 243e7c801995fa0146b3564f41321ca234a8b1d2 (diff) | |
parent | c4b334d4679d6fc38e13b2d84af2d832f6c47566 (diff) | |
download | go-git-99457e570d34320b12fb4fcd0f054f3d0b1d3eec.tar.gz |
Merge pull request #375 from noerw/add-remoteurl-option
Remote: add RemoteURL to {Fetch,Pull,Push}Options
Diffstat (limited to 'remote_test.go')
-rw-r--r-- | remote_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go index 66ca6b3..0283e64 100644 --- a/remote_test.go +++ b/remote_test.go @@ -46,6 +46,12 @@ func (s *RemoteSuite) TestFetchInvalidSchemaEndpoint(c *C) { c.Assert(err, ErrorMatches, ".*unsupported scheme.*") } +func (s *RemoteSuite) TestFetchOverriddenEndpoint(c *C) { + r := NewRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"http://perfectly-valid-url.example.com"}}) + err := r.Fetch(&FetchOptions{RemoteURL: "http://\\"}) + c.Assert(err, ErrorMatches, ".*invalid character.*") +} + func (s *RemoteSuite) TestFetchInvalidFetchOptions(c *C) { r := NewRemote(nil, &config.RemoteConfig{Name: "foo", URLs: []string{"qux://foo"}}) invalid := config.RefSpec("^*$ñ") @@ -963,6 +969,12 @@ func (s *RemoteSuite) TestPushNonExistentEndpoint(c *C) { c.Assert(err, NotNil) } +func (s *RemoteSuite) TestPushOverriddenEndpoint(c *C) { + r := NewRemote(nil, &config.RemoteConfig{Name: "origin", URLs: []string{"http://perfectly-valid-url.example.com"}}) + err := r.Push(&PushOptions{RemoteURL: "http://\\"}) + c.Assert(err, ErrorMatches, ".*invalid character.*") +} + func (s *RemoteSuite) TestPushInvalidSchemaEndpoint(c *C) { r := NewRemote(nil, &config.RemoteConfig{Name: "origin", URLs: []string{"qux://foo"}}) err := r.Push(&PushOptions{}) |