aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/models/repo.go b/models/repo.go
index 02b4e9fbc7..7de9499ae5 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -494,6 +494,11 @@ type CloneLink struct {
Git string
}
+// ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
+func ComposeHTTPSCloneURL(owner, repo string) string {
+ return fmt.Sprintf("%s%s/%s.git", setting.AppUrl, owner, repo)
+}
+
func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
repoName := repo.Name
if isWiki {
@@ -507,7 +512,7 @@ func (repo *Repository) cloneLink(isWiki bool) *CloneLink {
} else {
cl.SSH = fmt.Sprintf("%s@%s:%s/%s.git", setting.RunUser, setting.SSH.Domain, repo.Owner.Name, repoName)
}
- cl.HTTPS = fmt.Sprintf("%s%s/%s.git", setting.AppUrl, repo.Owner.Name, repoName)
+ cl.HTTPS = ComposeHTTPSCloneURL(repo.Owner.Name, repo.Name)
return cl
}