Browse Source

repo: handle git.ErrUnsupportedVersion error type

pull/4017/merge
Unknwon 8 years ago
parent
commit
ab42671c63
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 1
      conf/locale/locale_en-US.ini
  2. 2
      gogs.go
  3. 5
      models/repo.go
  4. 4
      modules/bindata/bindata.go
  5. 4
      routers/repo/setting.go
  6. 2
      templates/.VERSION
  7. 5
      templates/base/alert.tmpl

1
conf/locale/locale_en-US.ini

@ -662,6 +662,7 @@ settings.branches_bare = You cannot manage branches for bare repository. Please
settings.default_branch = Default Branch
settings.default_branch_desc = The default branch is considered the "base" branch for code commits, pull requests and online editing.
settings.update = Update
settings.update_default_branch_unsupported = Change default branch is not supported by the Git version on server.
settings.update_default_branch_success = Default branch of this repository has been updated successfully!
settings.protected_branches = Protected Branches
settings.protected_branches_desc = Protect branches from force pushing, accidental deletion and whitelist code committers.

2
gogs.go

@ -16,7 +16,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.10.34.0330 / 0.11 RC"
const APP_VER = "0.10.34.0401 / 0.11 RC"
func init() {
setting.AppVer = APP_VER

5
models/repo.go

@ -335,9 +335,14 @@ func (repo *Repository) mustOwner(e Engine) *User {
func (repo *Repository) UpdateSize() error {
countObject, err := git.GetRepoSize(repo.RepoPath())
if err != nil {
if !git.IsErrUnsupportedVersion(err) {
return fmt.Errorf("GetRepoSize: %v", err)
}
log.Warn("Get repository size is not supported by the Git version on server")
return nil
}
repo.Size = countObject.Size + countObject.SizePack
if _, err = x.Id(repo.ID).Cols("size").Update(repo); err != nil {
return fmt.Errorf("update size: %v", err)

4
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

4
routers/repo/setting.go

@ -404,6 +404,10 @@ func UpdateDefaultBranch(ctx *context.Context) {
ctx.Handle(500, "SetDefaultBranch", err)
return
}
ctx.Flash.Warning(ctx.Tr("repo.settings.update_default_branch_unsupported"))
ctx.Redirect(ctx.Repo.RepoLink + "/settings/branches")
return
}
}

2
templates/.VERSION

@ -1 +1 @@
0.10.34.0330 / 0.11 RC
0.10.34.0401 / 0.11 RC

5
templates/base/alert.tmpl

@ -3,6 +3,11 @@
<p>{{.Flash.ErrorMsg | Str2html}}</p>
</div>
{{end}}
{{if .Flash.WarningMsg}}
<div class="ui warning message">
<p>{{.Flash.WarningMsg | Str2html}}</p>
</div>
{{end}}
{{if .Flash.SuccessMsg}}
<div class="ui positive message">
<p>{{.Flash.SuccessMsg | Str2html}}</p>

Loading…
Cancel
Save