repo: handle git.ErrUnsupportedVersion error type

master
Unknwon 2017-04-01 17:56:55 -04:00
parent b3ac33cbcf
commit ab42671c63
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
7 changed files with 20 additions and 5 deletions

View File

@ -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.

View File

@ -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

View File

@ -335,7 +335,12 @@ func (repo *Repository) mustOwner(e Engine) *User {
func (repo *Repository) UpdateSize() error {
countObject, err := git.GetRepoSize(repo.RepoPath())
if err != nil {
return fmt.Errorf("GetRepoSize: %v", err)
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

File diff suppressed because one or more lines are too long

View File

@ -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
}
}

View File

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

View File

@ -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>