diff --git a/commands/command_env.go b/commands/command_env.go index 3b6490b5..2695c608 100644 --- a/commands/command_env.go +++ b/commands/command_env.go @@ -16,7 +16,7 @@ var ( func envCommand(cmd *cobra.Command, args []string) { lfs.ShowConfigWarnings = true config := lfs.Config - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") gitV, err := git.Config.Version() if err != nil { @@ -28,14 +28,14 @@ func envCommand(cmd *cobra.Command, args []string) { Print("") if len(endpoint.Url) > 0 { - Print("Endpoint=%s (auth=%s)", endpoint.Url, config.Access()) + Print("Endpoint=%s (auth=%s)", endpoint.Url, config.EndpointAccess(endpoint)) if len(endpoint.SshUserAndHost) > 0 { Print(" SSH=%s:%s", endpoint.SshUserAndHost, endpoint.SshPath) } } for _, remote := range config.Remotes() { - remoteEndpoint := config.RemoteEndpoint(remote) + remoteEndpoint := config.RemoteEndpoint(remote, "download") Print("Endpoint (%s)=%s (auth=%s)", remote, remoteEndpoint.Url, config.EndpointAccess(remoteEndpoint)) if len(remoteEndpoint.SshUserAndHost) > 0 { Print(" SSH=%s:%s", remoteEndpoint.SshUserAndHost, remoteEndpoint.SshPath) diff --git a/docs/man/git-lfs-config.5.ronn b/docs/man/git-lfs-config.5.ronn index a4a959e7..64c38f10 100644 --- a/docs/man/git-lfs-config.5.ronn +++ b/docs/man/git-lfs-config.5.ronn @@ -17,6 +17,11 @@ lfs option can be scoped inside the configuration for a remote. The url used to call the Git LFS remote API. Default blank (derive from clone URL). +* `lfs.pushurl` / `.lfspushurl` + + The url used to call the Git LFS remote API when pushing. Default blank (derive + from either LFS non-push urls or clone url). + * `lfs.concurrenttransfers` The number of concurrent uploads/downloads. Default 3. diff --git a/lfs/client.go b/lfs/client.go index 06c0bcbb..cd7a801a 100644 --- a/lfs/client.go +++ b/lfs/client.go @@ -241,7 +241,7 @@ func Batch(objects []*ObjectResource, operation string) ([]*ObjectResource, erro } if IsAuthError(err) { - setAuthType(res) + setAuthType(req, res) return Batch(objects, operation) } @@ -296,7 +296,7 @@ func UploadCheck(oidPath string) (*ObjectResource, error) { if err != nil { if IsAuthError(err) { - setAuthType(res) + setAuthType(req, res) return UploadCheck(oidPath) } @@ -422,12 +422,21 @@ func doLegacyApiRequest(req *http.Request) (*http.Response, *ObjectResource, err return res, obj, nil } +// HttpRequestToOperation determines the operation type for a http.Request +func getOperationForHttpRequest(req *http.Request) string { + operation := "download" + if req.Method == "POST" || req.Method == "PUT" { + operation = "upload" + } + return operation +} + // doApiBatchRequest runs the request to the LFS batch API. If the API returns a // 401, the repo will be marked as having private access and the request will be // re-run. When the repo is marked as having private access, credentials will // be retrieved. func doApiBatchRequest(req *http.Request) (*http.Response, []*ObjectResource, error) { - res, err := doAPIRequest(req, Config.PrivateAccess()) + res, err := doAPIRequest(req, Config.PrivateAccess(getOperationForHttpRequest(req))) if err != nil { if res != nil && res.StatusCode == 401 { @@ -474,7 +483,7 @@ func doHttpRequest(req *http.Request, creds Creds) (*http.Response, error) { err error ) - if Config.NtlmAccess() { + if Config.NtlmAccess(getOperationForHttpRequest(req)) { res, err = DoNTLMRequest(req, true) } else { res, err = Config.HttpClient().Do(req) @@ -491,7 +500,7 @@ func doHttpRequest(req *http.Request, creds Creds) (*http.Response, error) { if err != nil { if IsAuthError(err) { - setAuthType(res) + setAuthType(req, res) doHttpRequest(req, creds) } else { err = Error(err) @@ -633,7 +642,6 @@ func defaultError(res *http.Response) error { } func newApiRequest(method, oid string) (*http.Request, error) { - endpoint := Config.Endpoint() objectOid := oid operation := "download" if method == "POST" { @@ -642,6 +650,7 @@ func newApiRequest(method, oid string) (*http.Request, error) { operation = "upload" } } + endpoint := Config.Endpoint(operation) res, err := sshAuthenticate(endpoint, operation, oid) if err != nil { @@ -685,7 +694,7 @@ func newClientRequest(method, rawurl string, header map[string]string) (*http.Re } func newBatchApiRequest(operation string) (*http.Request, error) { - endpoint := Config.Endpoint() + endpoint := Config.Endpoint(operation) res, err := sshAuthenticate(endpoint, operation, "") if err != nil { @@ -731,7 +740,7 @@ func newBatchClientRequest(method, rawurl string) (*http.Request, error) { } func setRequestAuthFromUrl(req *http.Request, u *url.URL) bool { - if !Config.NtlmAccess() && u.User != nil { + if !Config.NtlmAccess(getOperationForHttpRequest(req)) && u.User != nil { if pass, ok := u.User.Password(); ok { fmt.Fprintln(os.Stderr, "warning: current Git remote contains credentials") setRequestAuth(req, u.User.Username(), pass) @@ -742,9 +751,10 @@ func setRequestAuthFromUrl(req *http.Request, u *url.URL) bool { return false } -func setAuthType(res *http.Response) { +func setAuthType(req *http.Request, res *http.Response) { authType := getAuthType(res) - Config.SetAccess(authType) + operation := getOperationForHttpRequest(req) + Config.SetAccess(operation, authType) tracerx.Printf("api: http response indicates %q authentication. Resubmitting...", authType) } @@ -762,7 +772,7 @@ func getAuthType(res *http.Response) string { } func setRequestAuth(req *http.Request, user, pass string) { - if Config.NtlmAccess() { + if Config.NtlmAccess(getOperationForHttpRequest(req)) { return } @@ -782,7 +792,7 @@ func setErrorResponseContext(err error, res *http.Response) { } func setErrorRequestContext(err error, req *http.Request) { - ErrorSetContext(err, "Endpoint", Config.Endpoint().Url) + ErrorSetContext(err, "Endpoint", Config.Endpoint(getOperationForHttpRequest(req)).Url) ErrorSetContext(err, "URL", fmt.Sprintf("%s %s", req.Method, req.URL.String())) setErrorHeaderContext(err, "Response", req.Header) } diff --git a/lfs/config.go b/lfs/config.go index 3c8196c3..bd80ed95 100644 --- a/lfs/config.go +++ b/lfs/config.go @@ -3,7 +3,6 @@ package lfs import ( "fmt" "net/http" - "net/url" "os" "path/filepath" "strconv" @@ -110,22 +109,47 @@ func (c *Configuration) GetenvBool(key string, def bool) bool { return b } -func (c *Configuration) Endpoint() Endpoint { +// GitRemoteUrl returns the git clone/push url for a given remote (blank if not found) +// the forpush argument is to cater for separate remote.name.pushurl settings +func (c *Configuration) GitRemoteUrl(remote string, forpush bool) string { + + if forpush { + if u, ok := c.GitConfig("remote." + remote + ".pushurl"); ok { + return u + } + } + + if u, ok := c.GitConfig("remote." + remote + ".url"); ok { + return u + } + + return "" + +} + +func (c *Configuration) Endpoint(operation string) Endpoint { + + if operation == "upload" { + if url, ok := c.GitConfig("lfs.pushurl"); ok { + return NewEndpoint(url) + } + } + if url, ok := c.GitConfig("lfs.url"); ok { return NewEndpoint(url) } if len(c.CurrentRemote) > 0 && c.CurrentRemote != defaultRemote { - if endpoint := c.RemoteEndpoint(c.CurrentRemote); len(endpoint.Url) > 0 { + if endpoint := c.RemoteEndpoint(c.CurrentRemote, operation); len(endpoint.Url) > 0 { return endpoint } } - return c.RemoteEndpoint(defaultRemote) + return c.RemoteEndpoint(defaultRemote, operation) } func (c *Configuration) ConcurrentTransfers() int { - if c.NtlmAccess() { + if c.NtlmAccess("download") { return 1 } @@ -155,26 +179,26 @@ func (c *Configuration) BatchTransfer() bool { return useBatch } -func (c *Configuration) NtlmAccess() bool { - return c.Access() == "ntlm" +func (c *Configuration) NtlmAccess(operation string) bool { + return c.Access(operation) == "ntlm" } // PrivateAccess will retrieve the access value and return true if // the value is set to private. When a repo is marked as having private // access, the http requests for the batch api will fetch the credentials // before running, otherwise the request will run without credentials. -func (c *Configuration) PrivateAccess() bool { - return c.Access() != "none" +func (c *Configuration) PrivateAccess(operation string) bool { + return c.Access(operation) != "none" } // Access returns the access auth type. -func (c *Configuration) Access() string { - return c.EndpointAccess(c.Endpoint()) +func (c *Configuration) Access(operation string) string { + return c.EndpointAccess(c.Endpoint(operation)) } // SetAccess will set the private access flag in .git/config. -func (c *Configuration) SetAccess(authType string) { - c.SetEndpointAccess(c.Endpoint(), authType) +func (c *Configuration) SetAccess(operation string, authType string) { + c.SetEndpointAccess(c.Endpoint(operation), authType) } func (c *Configuration) EndpointAccess(e Endpoint) string { @@ -220,15 +244,23 @@ func (c *Configuration) FetchExcludePaths() []string { return c.fetchExcludePaths } -func (c *Configuration) RemoteEndpoint(remote string) Endpoint { +func (c *Configuration) RemoteEndpoint(remote, operation string) Endpoint { if len(remote) == 0 { remote = defaultRemote } + + // Support separate push URL if specified and pushing + if operation == "upload" { + if url, ok := c.GitConfig("remote." + remote + ".lfspushurl"); ok { + return NewEndpoint(url) + } + } if url, ok := c.GitConfig("remote." + remote + ".lfsurl"); ok { return NewEndpoint(url) } - if url, ok := c.GitConfig("remote." + remote + ".url"); ok { + // finally fall back on git remote url (also supports pushurl) + if url := c.GitRemoteUrl(remote, operation == "upload"); url != "" { return NewEndpointFromCloneURL(url) } @@ -256,10 +288,6 @@ func (c *Configuration) AllGitConfig() map[string]string { return c.gitConfig } -func (c *Configuration) ObjectUrl(oid string) (*url.URL, error) { - return ObjectUrl(c.Endpoint(), oid) -} - func (c *Configuration) FetchPruneConfig() *FetchPruneConfig { if c.fetchPruneConfig == nil { c.fetchPruneConfig = &FetchPruneConfig{ diff --git a/lfs/config_test.go b/lfs/config_test.go index 50377ecc..e4c48e39 100644 --- a/lfs/config_test.go +++ b/lfs/config_test.go @@ -12,7 +12,7 @@ func TestEndpointDefaultsToOrigin(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "abc", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) @@ -27,7 +27,7 @@ func TestEndpointOverridesOrigin(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "abc", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) @@ -42,7 +42,7 @@ func TestEndpointNoOverrideDefaultRemote(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "abc", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) @@ -59,7 +59,7 @@ func TestEndpointUseAlternateRemote(t *testing.T) { config.CurrentRemote = "other" - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "def", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) @@ -71,7 +71,7 @@ func TestEndpointAddsLfsSuffix(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "https://example.com/foo/bar.git/info/lfs", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) @@ -83,12 +83,72 @@ func TestBareEndpointAddsLfsSuffix(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "https://example.com/foo/bar.git/info/lfs", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) } +func TestEndpointSeparateClonePushUrl(t *testing.T) { + config := &Configuration{ + gitConfig: map[string]string{ + "remote.origin.url": "https://example.com/foo/bar.git", + "remote.origin.pushurl": "https://readwrite.com/foo/bar.git"}, + remotes: []string{}, + } + + endpoint := config.Endpoint("download") + assert.Equal(t, "https://example.com/foo/bar.git/info/lfs", endpoint.Url) + assert.Equal(t, "", endpoint.SshUserAndHost) + assert.Equal(t, "", endpoint.SshPath) + + endpoint = config.Endpoint("upload") + assert.Equal(t, "https://readwrite.com/foo/bar.git/info/lfs", endpoint.Url) + assert.Equal(t, "", endpoint.SshUserAndHost) + assert.Equal(t, "", endpoint.SshPath) +} + +func TestEndpointOverriddenSeparateClonePushLfsUrl(t *testing.T) { + config := &Configuration{ + gitConfig: map[string]string{ + "remote.origin.url": "https://example.com/foo/bar.git", + "remote.origin.pushurl": "https://readwrite.com/foo/bar.git", + "remote.origin.lfsurl": "https://examplelfs.com/foo/bar", + "remote.origin.lfspushurl": "https://readwritelfs.com/foo/bar"}, + remotes: []string{}, + } + + endpoint := config.Endpoint("download") + assert.Equal(t, "https://examplelfs.com/foo/bar", endpoint.Url) + assert.Equal(t, "", endpoint.SshUserAndHost) + assert.Equal(t, "", endpoint.SshPath) + + endpoint = config.Endpoint("upload") + assert.Equal(t, "https://readwritelfs.com/foo/bar", endpoint.Url) + assert.Equal(t, "", endpoint.SshUserAndHost) + assert.Equal(t, "", endpoint.SshPath) +} + +func TestEndpointGlobalSeparateLfsPush(t *testing.T) { + config := &Configuration{ + gitConfig: map[string]string{ + "lfs.url": "https://readonly.com/foo/bar", + "lfs.pushurl": "https://write.com/foo/bar", + }, + remotes: []string{}, + } + + endpoint := config.Endpoint("download") + assert.Equal(t, "https://readonly.com/foo/bar", endpoint.Url) + assert.Equal(t, "", endpoint.SshUserAndHost) + assert.Equal(t, "", endpoint.SshPath) + + endpoint = config.Endpoint("upload") + assert.Equal(t, "https://write.com/foo/bar", endpoint.Url) + assert.Equal(t, "", endpoint.SshUserAndHost) + assert.Equal(t, "", endpoint.SshPath) +} + func TestSSHEndpointOverridden(t *testing.T) { config := &Configuration{ gitConfig: map[string]string{ @@ -98,7 +158,7 @@ func TestSSHEndpointOverridden(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "lfs", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) @@ -111,7 +171,7 @@ func TestSSHEndpointAddsLfsSuffix(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "https://example.com/foo/bar.git/info/lfs", endpoint.Url) assert.Equal(t, "git@example.com", endpoint.SshUserAndHost) assert.Equal(t, "foo/bar", endpoint.SshPath) @@ -124,7 +184,7 @@ func TestSSHCustomPortEndpointAddsLfsSuffix(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "https://example.com/foo/bar.git/info/lfs", endpoint.Url) assert.Equal(t, "git@example.com", endpoint.SshUserAndHost) assert.Equal(t, "foo/bar", endpoint.SshPath) @@ -137,7 +197,7 @@ func TestBareSSHEndpointAddsLfsSuffix(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "https://example.com/foo/bar.git/info/lfs", endpoint.Url) assert.Equal(t, "git@example.com", endpoint.SshUserAndHost) assert.Equal(t, "foo/bar.git", endpoint.SshPath) @@ -150,7 +210,7 @@ func TestSSHEndpointFromGlobalLfsUrl(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "https://example.com/foo/bar.git", endpoint.Url) assert.Equal(t, "git@example.com", endpoint.SshUserAndHost) assert.Equal(t, "foo/bar.git", endpoint.SshPath) @@ -163,7 +223,7 @@ func TestHTTPEndpointAddsLfsSuffix(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "http://example.com/foo/bar.git/info/lfs", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) @@ -176,58 +236,13 @@ func TestBareHTTPEndpointAddsLfsSuffix(t *testing.T) { remotes: []string{}, } - endpoint := config.Endpoint() + endpoint := config.Endpoint("download") assert.Equal(t, "http://example.com/foo/bar.git/info/lfs", endpoint.Url) assert.Equal(t, "", endpoint.SshUserAndHost) assert.Equal(t, "", endpoint.SshPath) assert.Equal(t, "", endpoint.SshPort) } -func TestObjectUrl(t *testing.T) { - defer Config.ResetConfig() - tests := map[string]string{ - "http://example.com": "http://example.com/objects/oid", - "http://example.com/": "http://example.com/objects/oid", - "http://example.com/foo": "http://example.com/foo/objects/oid", - "http://example.com/foo/": "http://example.com/foo/objects/oid", - } - - for endpoint, expected := range tests { - Config.SetConfig("lfs.url", endpoint) - u, err := Config.ObjectUrl("oid") - if err != nil { - t.Errorf("Error building URL for %s: %s", endpoint, err) - } else { - if actual := u.String(); expected != actual { - t.Errorf("Expected %s, got %s", expected, u.String()) - } - } - } -} - -func TestObjectsUrl(t *testing.T) { - defer Config.ResetConfig() - - tests := map[string]string{ - "http://example.com": "http://example.com/objects", - "http://example.com/": "http://example.com/objects", - "http://example.com/foo": "http://example.com/foo/objects", - "http://example.com/foo/": "http://example.com/foo/objects", - } - - for endpoint, expected := range tests { - Config.SetConfig("lfs.url", endpoint) - u, err := Config.ObjectUrl("") - if err != nil { - t.Errorf("Error building URL for %s: %s", endpoint, err) - } else { - if actual := u.String(); expected != actual { - t.Errorf("Expected %s, got %s", expected, u.String()) - } - } - } -} - func TestConcurrentTransfersSetValue(t *testing.T) { config := &Configuration{ gitConfig: map[string]string{ @@ -333,20 +348,56 @@ func TestAccessConfig(t *testing.T) { }, } - if access := config.Access(); access != expected.Access { + if access := config.Access("download"); access != expected.Access { + t.Errorf("Expected Access() with value %q to be %v, got %v", value, expected.Access, access) + } + if access := config.Access("upload"); access != expected.Access { t.Errorf("Expected Access() with value %q to be %v, got %v", value, expected.Access, access) } - if priv := config.PrivateAccess(); priv != expected.PrivateAccess { + if priv := config.PrivateAccess("download"); priv != expected.PrivateAccess { + t.Errorf("Expected PrivateAccess() with value %q to be %v, got %v", value, expected.PrivateAccess, priv) + } + if priv := config.PrivateAccess("upload"); priv != expected.PrivateAccess { t.Errorf("Expected PrivateAccess() with value %q to be %v, got %v", value, expected.PrivateAccess, priv) } } + + // Test again but with separate push url + for value, expected := range tests { + config := &Configuration{ + gitConfig: map[string]string{ + "lfs.url": "http://example.com", + "lfs.pushurl": "http://examplepush.com", + "lfs.http://example.com.access": value, + "lfs.http://examplepush.com.access": value, + "lfs.https://example.com.access": "bad", + }, + } + + if access := config.Access("download"); access != expected.Access { + t.Errorf("Expected Access() with value %q to be %v, got %v", value, expected.Access, access) + } + if access := config.Access("upload"); access != expected.Access { + t.Errorf("Expected Access() with value %q to be %v, got %v", value, expected.Access, access) + } + + if priv := config.PrivateAccess("download"); priv != expected.PrivateAccess { + t.Errorf("Expected PrivateAccess() with value %q to be %v, got %v", value, expected.PrivateAccess, priv) + } + if priv := config.PrivateAccess("upload"); priv != expected.PrivateAccess { + t.Errorf("Expected PrivateAccess() with value %q to be %v, got %v", value, expected.PrivateAccess, priv) + } + } + } func TestAccessAbsentConfig(t *testing.T) { config := &Configuration{} - assert.Equal(t, "none", config.Access()) - assert.Equal(t, false, config.PrivateAccess()) + assert.Equal(t, "none", config.Access("download")) + assert.Equal(t, "none", config.Access("upload")) + assert.Equal(t, false, config.PrivateAccess("download")) + assert.Equal(t, false, config.PrivateAccess("upload")) } func TestLoadValidExtension(t *testing.T) { diff --git a/lfs/credentials.go b/lfs/credentials.go index 1d9b7f48..e45b727d 100644 --- a/lfs/credentials.go +++ b/lfs/credentials.go @@ -51,7 +51,8 @@ func getCredsForAPI(req *http.Request) (Creds, error) { } func getCredURLForAPI(req *http.Request) (*url.URL, error) { - apiUrl, err := Config.ObjectUrl("") + operation := getOperationForHttpRequest(req) + apiUrl, err := url.Parse(Config.Endpoint(operation).Url) if err != nil { return nil, err } @@ -69,7 +70,7 @@ func getCredURLForAPI(req *http.Request) (*url.URL, error) { credsUrl := apiUrl if len(Config.CurrentRemote) > 0 { - if u, ok := Config.GitConfig("remote." + Config.CurrentRemote + ".url"); ok { + if u := Config.GitRemoteUrl(Config.CurrentRemote, operation == "upload"); u != "" { gitRemoteUrl, err := url.Parse(u) if err != nil { return nil, err @@ -90,7 +91,7 @@ func getCredURLForAPI(req *http.Request) (*url.URL, error) { } func skipCredsCheck(req *http.Request) bool { - if Config.NtlmAccess() { + if Config.NtlmAccess(getOperationForHttpRequest(req)) { return false } diff --git a/lfs/ssh_test.go b/lfs/ssh_test.go index fb33d4ed..bec03f53 100644 --- a/lfs/ssh_test.go +++ b/lfs/ssh_test.go @@ -8,7 +8,7 @@ import ( ) func TestSSHGetExeAndArgsSsh(t *testing.T) { - endpoint := Config.Endpoint() + endpoint := Config.Endpoint("download") endpoint.SshUserAndHost = "user@foo.com" oldGITSSH := Config.Getenv("GIT_SSH") Config.Setenv("GIT_SSH", "") @@ -20,7 +20,7 @@ func TestSSHGetExeAndArgsSsh(t *testing.T) { } func TestSSHGetExeAndArgsSshCustomPort(t *testing.T) { - endpoint := Config.Endpoint() + endpoint := Config.Endpoint("download") endpoint.SshUserAndHost = "user@foo.com" endpoint.SshPort = "8888" oldGITSSH := Config.Getenv("GIT_SSH") @@ -33,7 +33,7 @@ func TestSSHGetExeAndArgsSshCustomPort(t *testing.T) { } func TestSSHGetExeAndArgsPlink(t *testing.T) { - endpoint := Config.Endpoint() + endpoint := Config.Endpoint("download") endpoint.SshUserAndHost = "user@foo.com" oldGITSSH := Config.Getenv("GIT_SSH") // this will run on non-Windows platforms too but no biggie @@ -47,7 +47,7 @@ func TestSSHGetExeAndArgsPlink(t *testing.T) { } func TestSSHGetExeAndArgsPlinkCustomPort(t *testing.T) { - endpoint := Config.Endpoint() + endpoint := Config.Endpoint("download") endpoint.SshUserAndHost = "user@foo.com" endpoint.SshPort = "8888" oldGITSSH := Config.Getenv("GIT_SSH") @@ -62,7 +62,7 @@ func TestSSHGetExeAndArgsPlinkCustomPort(t *testing.T) { } func TestSSHGetExeAndArgsTortoisePlink(t *testing.T) { - endpoint := Config.Endpoint() + endpoint := Config.Endpoint("download") endpoint.SshUserAndHost = "user@foo.com" oldGITSSH := Config.Getenv("GIT_SSH") // this will run on non-Windows platforms too but no biggie @@ -76,7 +76,7 @@ func TestSSHGetExeAndArgsTortoisePlink(t *testing.T) { } func TestSSHGetExeAndArgsTortoisePlinkCustomPort(t *testing.T) { - endpoint := Config.Endpoint() + endpoint := Config.Endpoint("download") endpoint.SshUserAndHost = "user@foo.com" endpoint.SshPort = "8888" oldGITSSH := Config.Getenv("GIT_SSH")