Skip to content

Commit

Permalink
Merge pull request #3 from gitsight/fix/ssh-remote
Browse files Browse the repository at this point in the history
Fix ssh remote generation
  • Loading branch information
jfontan authored Feb 22, 2023
2 parents 9967c9f + 2dd82ce commit 1c66d7f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.13.x, 1.14.x]
go-version: [1.19.x, 1.20.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
8 changes: 4 additions & 4 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ func ExampleParse() {
// 1. git github.com/alice/libfoo
// name: libfoo
// host: github.com
// remote: [email protected]/alice/libfoo.git
// remote: [email protected]:alice/libfoo.git
// 2. git github.com/bob/libbar
// name: libbar
// host: github.com
// remote: [email protected]/bob/libbar.git
// remote: [email protected]:bob/libbar.git
// 3. git gitlab.com/foo/bar
// name: bar
// host: gitlab.com
// remote: [email protected]/foo/bar.git
// remote: [email protected]:foo/bar.git
// 4. git github.com/go-enry/go-enry
// name: go-enry
// host: github.com
// remote: [email protected]/go-enry/go-enry.git
// remote: [email protected]:go-enry/go-enry.git
// commit-ish: v2.4.1
}
2 changes: 1 addition & 1 deletion vcsurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (v *VCS) remoteUnknownHost(p Protocol) (string, error) {
// [email protected]:go-git/go-git.git
// git clone [email protected]:mcuadros/discovery-rest.git
func (v *VCS) sshRemote() string {
return fmt.Sprintf("git@%s/%s/%s.git", v.Host, v.Username, v.Name)
return fmt.Sprintf("git@%s:%s/%s.git", v.Host, v.Username, v.Name)
}

// https://[email protected]/mcuadros/discovery-rest.git
Expand Down
6 changes: 3 additions & 3 deletions vcsurl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ func TestVCSRemote(t *testing.T) {
expected string
err error
}{
{"https://github.com/foo/bar", vcsurl.SSH, "[email protected]/foo/bar.git", nil},
{"https://github.com/foo/bar", vcsurl.SSH, "[email protected]:foo/bar.git", nil},
{"https://github.com/foo/bar", vcsurl.HTTPS, "https://github.com/foo/bar.git", nil},
{"https://bitbucket.org/foo/bar", vcsurl.SSH, "[email protected]/foo/bar.git", nil},
{"https://bitbucket.org/foo/bar", vcsurl.SSH, "[email protected]:foo/bar.git", nil},
{"https://bitbucket.org/foo/bar", vcsurl.HTTPS, "https://bitbucket.org/foo/bar.git", nil},
{"https://gitlab.com/foo/bar", vcsurl.SSH, "[email protected]/foo/bar.git", nil},
{"https://gitlab.com/foo/bar", vcsurl.SSH, "[email protected]:foo/bar.git", nil},
{"https://gitlab.com/foo/bar", vcsurl.HTTPS, "https://gitlab.com/foo/bar.git", nil},
{"git://git.savannah.gnu.org/bash.git", vcsurl.SSH, "", vcsurl.ErrUnsupportedProtocol},
{"git://git.savannah.gnu.org/bash.git", vcsurl.HTTPS, "", vcsurl.ErrUnsupportedProtocol},
Expand Down

0 comments on commit 1c66d7f

Please sign in to comment.