]> source.dussan.org Git - gitea.git/commitdiff
Remove GoGet option from repository and handle it with ?go-get=1 instead
authorPeter Smit <peter@smitmail.eu>
Tue, 17 Feb 2015 08:36:17 +0000 (10:36 +0200)
committerPeter Smit <peter@smitmail.eu>
Tue, 17 Feb 2015 08:36:17 +0000 (10:36 +0200)
The normal go get protocol is to show the go-import meta tag when ?go-get=1 is appended to the url. This commit implements that behaviour and cleans the go-get option from the repository settings page.

conf/locale/locale_en-US.ini
models/repo.go
modules/auth/repo_form.go
modules/middleware/repo.go
routers/repo/setting.go
templates/base/head.tmpl
templates/ng/base/head.tmpl
templates/repo/settings/options.tmpl

index 6b59be7391c21ceadc4e1b119bce56eadc58db33..54b80abb5eac0a7685888f7197495602ddf4e85c 100644 (file)
@@ -281,8 +281,6 @@ init_readme = Initialize this repository with a README.md
 create_repo = Create Repository
 default_branch = Default Branch
 mirror_interval = Mirror Interval (hour)
-goget_meta = Go-Get Meta
-goget_meta_helper = This repository will be <span class="label label-blue label-radius">Go-Getable</span>
 
 need_auth = Need Authorization
 migrate_type = Migration Type
index cdb838a1fb096ea2f312f7cd55955f76dfa30607..179120a311c175ecfc405deef665993942ea60ec 100644 (file)
@@ -154,7 +154,6 @@ type Repository struct {
 
        IsPrivate bool
        IsBare    bool
-       IsGoget   bool
 
        IsMirror bool
        *Mirror  `xorm:"-"`
index 36e62f04fb0a35aa7b49af81755a5131230d62d1..c771dd59b8c6ddd865f10c4da187c1e676d68169 100644 (file)
@@ -52,7 +52,6 @@ type RepoSettingForm struct {
        Branch      string `form:"branch"`
        Interval    int    `form:"interval"`
        Private     bool   `form:"private"`
-       GoGet       bool   `form:"goget"`
 }
 
 func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
index 1ab158dd6d8721a6be515f4ac53abca89bf3b4a8..67a9eda6910eb984277aa562943e53fdeb167879 100644 (file)
@@ -394,8 +394,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
                }
                ctx.Data["CloneLink"] = ctx.Repo.CloneLink
 
-               if ctx.Repo.Repository.IsGoget {
-                       ctx.Data["GoGetLink"] = fmt.Sprintf("%s%s/%s", setting.AppUrl, u.LowerName, repo.LowerName)
+               if ctx.Query("go-get") == "1" {
                        ctx.Data["GoGetImport"] = fmt.Sprintf("%s/%s/%s", setting.Domain, u.LowerName, repo.LowerName)
                }
 
index 33bf1eab28f5eaaf5fe0318d45a4fa3b19cc242b..8368513ad8261042df9f3a37312e2e55ba231057 100644 (file)
@@ -8,9 +8,9 @@ import (
        "encoding/json"
        "errors"
        "fmt"
+       "path"
        "strings"
        "time"
-       "path"
 
        "github.com/Unknwon/com"
 
@@ -84,7 +84,6 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
                ctx.Repo.Repository.Description = form.Description
                ctx.Repo.Repository.Website = form.Website
                ctx.Repo.Repository.IsPrivate = form.Private
-               ctx.Repo.Repository.IsGoget = form.GoGet
                if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
                        ctx.Handle(404, "UpdateRepository", err)
                        return
index 7775933ca930d9c0c99ebf99ea96a03576b6d8df..cb3951ea2c3ef01fa5f4110d4c8d0ae0ccbad270 100644 (file)
@@ -9,7 +9,7 @@
                <meta name="description" content="Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language" />
                <meta name="keywords" content="go, git">
                <meta name="_csrf" content="{{.CsrfToken}}" />
-               {{if .Repository.IsGoget}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
+               {{if .GoGetImport}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
 
                 <!-- Stylesheets -->
                {{if CdnMode}}
index 40a7d28ff2b33ff70463067c3251a09d5b79a810..f2a235bd43c75934c1723d9c89bb496cb8190759 100644 (file)
@@ -7,7 +7,7 @@
                <meta name="description" content="Gogs(Go Git Service) a painless self-hosted Git Service written in Go" />
                <meta name="keywords" content="go, git, self-hosted, gogs">
                <meta name="_csrf" content="{{.CsrfToken}}" />
-               {{if .Repository.IsGoget}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
+               {{if .GoGetImport}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
 
                <link rel="shortcut icon" href="{{AppSubUrl}}/img/favicon.png" />
 
index 093e9375537c16c8757454f9b1d25d525a420018..41683f84501c9a4c0d2238952ee1703713f82581 100644 (file)
                                                        <input class="ipt-chk" id="visibility" name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}} />
                                                        <span>{{.i18n.Tr "repo.visiblity_helper" | Str2html}}</span>
                                                    </div>
-                                                   <div class="field">
-                                                       <label for="goget">{{.i18n.Tr "repo.goget_meta"}}</label>
-                                                       <input class="ipt-chk" id="goget" name="goget" type="checkbox" {{if .Repository.IsGoget}}checked{{end}} />
-                                                       <span>{{.i18n.Tr "repo.goget_meta_helper" | Str2html}}</span>
-                                                   </div>
                                    <div class="field">
                                        <span class="form-label"></span>
                                        <button class="btn btn-green btn-large btn-radius" id="change-reponame-btn" href="#change-reponame-modal">{{.i18n.Tr "repo.settings.update_settings"}}</button>