MCPcopy
hub / github.com/cli/cli / FormatRemoteURL

Function FormatRemoteURL

internal/ghrepo/repo.go:95–103  ·  view source on GitHub ↗
(repo Interface, protocol string)

Source from the content-addressed store, hash-verified

93}
94
95func FormatRemoteURL(repo Interface, protocol string) string {
96 if protocol == "ssh" {
97 if tenant, found := ghinstance.TenantName(repo.RepoHost()); found {
98 return fmt.Sprintf("%s@%s:%s/%s.git", tenant, repo.RepoHost(), repo.RepoOwner(), repo.RepoName())
99 }
100 return fmt.Sprintf("git@%s:%s/%s.git", repo.RepoHost(), repo.RepoOwner(), repo.RepoName())
101 }
102 return fmt.Sprintf("%s%s/%s.git", ghinstance.HostPrefix(repo.RepoHost()), repo.RepoOwner(), repo.RepoName())
103}
104
105type ghRepo struct {
106 owner string

Callers 11

cloneRunFunction · 0.92
forkRunFunction · 0.92
createFromScratchFunction · 0.92
createFromTemplateFunction · 0.92
createFromLocalFunction · 0.92
updateRemoteFunction · 0.92
checkoutRunFunction · 0.92
cmdsForMissingRemoteFunction · 0.92
handlePushFunction · 0.92
installGitMethod · 0.92
TestFormatRemoteURLFunction · 0.85

Calls 5

TenantNameFunction · 0.92
HostPrefixFunction · 0.92
RepoHostMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65

Tested by 1

TestFormatRemoteURLFunction · 0.68