aboutsummaryrefslogtreecommitdiff
path: root/internal/gitutil/submodule_test.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-09-18 16:19:31 +0800
committerGitHub <noreply@github.com>2020-09-18 16:19:31 +0800
commitdda1092e74fa82f23a7ad62434fc60200f8df5ca (patch)
tree6e4d012ec23431947b52081d8f979acc1f3a2f21 /internal/gitutil/submodule_test.go
parent8b75e9a442fdd0768b8a6d1bd6dcb085bbb7f2b7 (diff)
gitutil: infer submodule with baseURL when it is a relative path (#6337)
Diffstat (limited to 'internal/gitutil/submodule_test.go')
-rw-r--r--internal/gitutil/submodule_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/gitutil/submodule_test.go b/internal/gitutil/submodule_test.go
index 2bfe5706..53f48766 100644
--- a/internal/gitutil/submodule_test.go
+++ b/internal/gitutil/submodule_test.go
@@ -42,6 +42,14 @@ func TestInferSubmoduleURL(t *testing.T) {
expURL: "http://github.com/gogs/docs-api/commit/6b08f76a5313fa3d26859515b30aa17a5faa2807",
},
{
+ name: "relative path",
+ submodule: &git.Submodule{
+ URL: "../repo2.git",
+ Commit: "6b08f76a5313fa3d26859515b30aa17a5faa2807",
+ },
+ expURL: "https://gogs.example.com/user/repo/../repo2/commit/6b08f76a5313fa3d26859515b30aa17a5faa2807",
+ },
+ {
name: "bad URL",
submodule: &git.Submodule{
URL: "ftp://example.com",
@@ -52,7 +60,7 @@ func TestInferSubmoduleURL(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
- assert.Equal(t, test.expURL, InferSubmoduleURL(test.submodule))
+ assert.Equal(t, test.expURL, InferSubmoduleURL("https://gogs.example.com/user/repo", test.submodule))
})
}
}