aboutsummaryrefslogtreecommitdiff
path: root/remote_url.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-16 02:28:55 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-16 02:28:55 +0800
commit6f9f62d453c94ac8d69baebcf51589d9b623d306 (patch)
treef311981eb5b86049ca85e9e2a58a86d5f4c45aea /remote_url.go
parenthttp_*: Add HTTP cloning (diff)
downloadforge-6f9f62d453c94ac8d69baebcf51589d9b623d306.tar.gz
forge-6f9f62d453c94ac8d69baebcf51589d9b623d306.tar.zst
forge-6f9f62d453c94ac8d69baebcf51589d9b623d306.zip
repo_index: Add HTTP clone along with SSH
Diffstat (limited to 'remote_url.go')
-rw-r--r--remote_url.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/remote_url.go b/remote_url.go
new file mode 100644
index 0000000..f64d6ec
--- /dev/null
+++ b/remote_url.go
@@ -0,0 +1,14 @@
+package main
+
+import (
+ "net/url"
+ "strings"
+)
+
+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)
+}