зеркало из https://github.com/golang/pkgsite.git
internal/source: add sourcehut templates
Add source templates for the sourcehut git hosting site (git.sr.ht). Fixes golang/go#38986. Change-Id: I581389affe3c777828189d8aa35e3910ffe1d130 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245039 Reviewed-by: Julie Qiu <julie@golang.org>
This commit is contained in:
Родитель
12d438f169
Коммит
d76e025a21
|
@ -449,6 +449,15 @@ var patterns = []struct {
|
|||
regexp.MustCompile(`^(?P<repo>gitee\.com/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(\.git|$)`),
|
||||
githubURLTemplates,
|
||||
},
|
||||
{
|
||||
regexp.MustCompile(`^(?P<repo>git\.sr\.ht/~[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)`),
|
||||
urlTemplates{
|
||||
Directory: "{repo}/tree/{commit}/{dir}",
|
||||
File: "{repo}/tree/{commit}/{file}",
|
||||
Line: "{repo}/tree/{commit}/{file}#L{line}",
|
||||
Raw: "{repo}/blob/{commit}/{file}",
|
||||
},
|
||||
},
|
||||
// Patterns that match the general go command pattern, where they must have
|
||||
// a ".git" repo suffix in an import path. If matching a repo URL from a meta tag,
|
||||
// there is no ".git".
|
||||
|
|
|
@ -213,6 +213,26 @@ func TestModuleInfo(t *testing.T) {
|
|||
"https://gitee.com/Billcoding/gotypes/blob/v0.1.0/type.go#L1",
|
||||
"https://gitee.com/Billcoding/gotypes/raw/v0.1.0/type.go",
|
||||
},
|
||||
{
|
||||
"sourcehut",
|
||||
"gioui.org", "v0.0.0-20200726090130-3b95e2918359", "op/op.go",
|
||||
|
||||
"https://git.sr.ht/~eliasnaur/gio",
|
||||
"https://git.sr.ht/~eliasnaur/gio/tree/3b95e2918359",
|
||||
"https://git.sr.ht/~eliasnaur/gio/tree/3b95e2918359/op/op.go",
|
||||
"https://git.sr.ht/~eliasnaur/gio/tree/3b95e2918359/op/op.go#L1",
|
||||
"https://git.sr.ht/~eliasnaur/gio/blob/3b95e2918359/op/op.go",
|
||||
},
|
||||
{
|
||||
"sourcehut nested",
|
||||
"gioui.org/app", "v0.0.0-20200726090130-3b95e2918359", "app.go",
|
||||
|
||||
"https://git.sr.ht/~eliasnaur/gio",
|
||||
"https://git.sr.ht/~eliasnaur/gio/tree/3b95e2918359/app",
|
||||
"https://git.sr.ht/~eliasnaur/gio/tree/3b95e2918359/app/app.go",
|
||||
"https://git.sr.ht/~eliasnaur/gio/tree/3b95e2918359/app/app.go#L1",
|
||||
"https://git.sr.ht/~eliasnaur/gio/blob/3b95e2918359/app/app.go",
|
||||
},
|
||||
{
|
||||
"v2 as a branch",
|
||||
"github.com/jrick/wsrpc/v2", "v2.1.1", "rpc.go",
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Загрузка…
Ссылка в новой задаче