1
0
Fork 0

Minor fix for #3246

This commit is contained in:
Unknwon 2016-07-09 13:42:05 +08:00
parent 98b152030d
commit 9fcf66f0e0
7 changed files with 937 additions and 719 deletions

View file

@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current tip version: 0.9.38 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions) ##### Current tip version: 0.9.40 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

View file

@ -350,11 +350,11 @@ readme_helper = Select a readme template
auto_init = Initialize this repository with selected files and template auto_init = Initialize this repository with selected files and template
create_repo = Create Repository create_repo = Create Repository
default_branch = Default Branch default_branch = Default Branch
mirror_prune = Prune
mirror_prune_desc = Remove any remote-tracking references that no longer exist on the remote
mirror_interval = Mirror Interval (hour) mirror_interval = Mirror Interval (hour)
mirror_address = Mirror Address mirror_address = Mirror Address
mirror_address_desc = Please include necessary user credentials in the address. mirror_address_desc = Please include necessary user credentials in the address.
mirror_enable_prune = Remove all objects references remotely removed in the mirror
mirror_prune = Prune
watchers = Watchers watchers = Watchers
stargazers = Stargazers stargazers = Stargazers
forks = Forks forks = Forks

View file

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.9.38.0708" const APP_VER = "0.9.40.0709"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View file

@ -547,10 +547,11 @@ func IsUsableName(name string) error {
// Mirror represents a mirror information of repository. // Mirror represents a mirror information of repository.
type Mirror struct { type Mirror struct {
ID int64 `xorm:"pk autoincr"` ID int64 `xorm:"pk autoincr"`
RepoID int64 RepoID int64
Repo *Repository `xorm:"-"` Repo *Repository `xorm:"-"`
Interval int // Hour. Interval int // Hour.
EnablePrune bool `xorm:"NOT NULL DEFAULT true"`
Updated time.Time `xorm:"-"` Updated time.Time `xorm:"-"`
UpdatedUnix int64 UpdatedUnix int64
@ -558,8 +559,6 @@ type Mirror struct {
NextUpdateUnix int64 NextUpdateUnix int64
address string `xorm:"-"` address string `xorm:"-"`
EnablePrune bool `xorm:"NOT NULL DEFAULT true"`
} }
func (m *Mirror) BeforeInsert() { func (m *Mirror) BeforeInsert() {
@ -1412,9 +1411,9 @@ func DeleteRepository(uid, repoID int64) error {
} }
if repo.NumForks > 0 { if repo.NumForks > 0 {
if _, err = x.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil { if _, err = x.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil {
log.Error(4, "reset 'fork_id' and 'is_fork': %v", err) log.Error(4, "reset 'fork_id' and 'is_fork': %v", err)
} }
} }
return nil return nil
@ -1684,9 +1683,9 @@ func MirrorUpdate() {
repoPath := m.Repo.RepoPath() repoPath := m.Repo.RepoPath()
var gitArgs = []string{"remote", "update"} gitArgs := []string{"remote", "update"}
if m.EnablePrune { if m.EnablePrune {
gitArgs = []string{"remote", "update", "--prune"} gitArgs = append(gitArgs, "--prune")
} }
if _, stderr, err := process.ExecDir( if _, stderr, err := process.ExecDir(

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
0.9.38.0708 0.9.40.0709

View file

@ -55,7 +55,7 @@
<label>{{.i18n.Tr "repo.mirror_prune"}}</label> <label>{{.i18n.Tr "repo.mirror_prune"}}</label>
<div class="ui checkbox"> <div class="ui checkbox">
<input id="enable_prune" name="enable_prune" type="checkbox" {{if .MirrorEnablePrune}}checked{{end}}> <input id="enable_prune" name="enable_prune" type="checkbox" {{if .MirrorEnablePrune}}checked{{end}}>
<label>{{.i18n.Tr "repo.mirror_enable_prune"}}</label> <label>{{.i18n.Tr "repo.mirror_prune_desc"}}</label>
</div> </div>
</div> </div>
<div class="inline field {{if .Err_Interval}}error{{end}}"> <div class="inline field {{if .Err_Interval}}error{{end}}">