mirror of
https://github.com/gogs/gogs.git
synced 2025-12-20 07:09:58 +01:00
gitutil: infer submodule with baseURL when it is a relative path (#6337)
This commit is contained in:
@@ -41,6 +41,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{
|
||||
@@ -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))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user