Skip to content

Commit 501207b

Browse files
committed
Merge pull request #280 from mboersma/fix-deis-create-git-remote
fix(client): replace port in git remote creation
2 parents d88e6f8 + 4e9fd46 commit 501207b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

client/pkg/git/git.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,7 @@ func findRemote(host string) (string, error) {
106106

107107
// RemoteURL returns the git URL of app.
108108
func RemoteURL(host, appID string) string {
109+
// Strip off any trailing :port number after the host name.
110+
host = strings.Split(host, ":")[0]
109111
return fmt.Sprintf("ssh://git@%s:2222/%s.git", host, appID)
110112
}

client/pkg/git/git_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ import (
77
func TestRemoteURL(t *testing.T) {
88
t.Parallel()
99

10+
actual := RemoteURL("example.com", "app")
1011
expected := "ssh://git@example.com:2222/app.git"
1112

12-
actual := RemoteURL("example.com", "app")
13+
if actual != expected {
14+
t.Errorf("Expected %s, Got %s", expected, actual)
15+
}
16+
17+
actual = RemoteURL("deis.10.245.1.3.xip.io:31350", "velcro-underdog")
18+
expected = "ssh://git@deis.10.245.1.3.xip.io:2222/velcro-underdog.git"
1319

1420
if actual != expected {
1521
t.Errorf("Expected %s, Got %s", expected, actual)

0 commit comments

Comments
 (0)