aboutsummaryrefslogblamecommitdiff
path: root/remote_url.go
blob: e478324bca87520ee231e27206fe45d090e84a77 (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                                                       



                 
                 

 

                                                                         
                                                                   
                                                                                                                                    
 

                                                                    
                                                                                                                                     
 
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileContributor: Runxi Yu <https://runxiyu.org>

package main

import (
	"net/url"
	"strings"
)

// We don't use path.Join because it collapses multiple slashes into one.

func generate_ssh_remote_url(group_name, repo_name string) string {
	return strings.TrimSuffix(config.SSH.Root, "/") + "/" + url.PathEscape(group_name) + "/:/repos/" + url.PathEscape(repo_name)
}

func generate_http_remote_url(group_name, repo_name string) string {
	return strings.TrimSuffix(config.HTTP.Root, "/") + "/" + url.PathEscape(group_name) + "/:/repos/" + url.PathEscape(repo_name)
}