summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-09-23 21:24:24 +0800
committerLauris BH <lauris@nix.lv>2017-09-23 16:24:24 +0300
commit2ef8b8bcbeeb7efabb6cfd247ad6227b0e2e21cd (patch)
tree85f3504183720e71bfcc93283ebd5d4f93b819fb /routers/repo
parent2db424c3f157409603645310a598dd0d974d90bf (diff)
downloadgitea-2ef8b8bcbeeb7efabb6cfd247ad6227b0e2e21cd.tar.gz
gitea-2ef8b8bcbeeb7efabb6cfd247ad6227b0e2e21cd.zip
fix go get subpackage bug (#2584)
* fix go get subpackage bug * merge the duplicated funtions
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/http.go22
1 files changed, 1 insertions, 21 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 4265c80ac4..3f6839ee36 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -22,35 +22,15 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
-
- "github.com/Unknwon/com"
)
-func composeGoGetImport(owner, repo, sub string) string {
- return path.Join(setting.Domain, setting.AppSubURL, owner, repo, sub)
-}
-
-// earlyResponseForGoGetMeta responses appropriate go-get meta with status 200
-// if user does not have actual access to the requested repository,
-// or the owner or repository does not exist at all.
-// This is particular a workaround for "go get" command which does not respect
-// .netrc file.
-func earlyResponseForGoGetMeta(ctx *context.Context, username, reponame, subpath string) {
- ctx.PlainText(200, []byte(com.Expand(`<meta name="go-import" content="{GoGetImport} git {CloneLink}">`,
- map[string]string{
- "GoGetImport": composeGoGetImport(username, reponame, subpath),
- "CloneLink": models.ComposeHTTPSCloneURL(username, reponame),
- })))
-}
-
// HTTP implmentation git smart HTTP protocol
func HTTP(ctx *context.Context) {
username := ctx.Params(":username")
reponame := strings.TrimSuffix(ctx.Params(":reponame"), ".git")
- subpath := ctx.Params("*")
if ctx.Query("go-get") == "1" {
- earlyResponseForGoGetMeta(ctx, username, reponame, subpath)
+ context.EarlyResponseForGoGetMeta(ctx)
return
}