mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 16:02:41 +01:00
work #1705
This commit is contained in:
parent
5cad124704
commit
cb100c7781
4 changed files with 48 additions and 3 deletions
|
@ -17,4 +17,6 @@ Luc Stepniewski <luc@stepniewski.fr>
|
||||||
Miguel de la Cruz <miguel@mcrx.me>
|
Miguel de la Cruz <miguel@mcrx.me>
|
||||||
Marc Schiller <marc@schiller.im>
|
Marc Schiller <marc@schiller.im>
|
||||||
Morten Sørensen <klim8d@gmail.com>
|
Morten Sørensen <klim8d@gmail.com>
|
||||||
Natan Albuquerque <natanalbuquerque5@gmail.com>
|
Natan Albuquerque <natanalbuquerque5@gmail.com>
|
||||||
|
Odilon Junior <odilon.junior93@gmail.com>
|
||||||
|
YJSoft <yjsoft@yjsoft.pe.kr>
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.6.19.1031 Beta"
|
const APP_VER = "0.6.20.1031 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ var migrations = []Migration{
|
||||||
NewMigration("generate issue-label from issue", issueToIssueLabel), // V6 -> V7:v0.6.4
|
NewMigration("generate issue-label from issue", issueToIssueLabel), // V6 -> V7:v0.6.4
|
||||||
NewMigration("refactor attachment table", attachmentRefactor), // V7 -> V8:v0.6.4
|
NewMigration("refactor attachment table", attachmentRefactor), // V7 -> V8:v0.6.4
|
||||||
NewMigration("rename pull request fields", renamePullRequestFields), // V8 -> V9:v0.6.16
|
NewMigration("rename pull request fields", renamePullRequestFields), // V8 -> V9:v0.6.16
|
||||||
|
NewMigration("clean up migrate repo info", cleanUpMigrateRepoInfo), // V9 -> V10:v0.6.20
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate database to current version
|
// Migrate database to current version
|
||||||
|
@ -653,3 +655,44 @@ func renamePullRequestFields(x *xorm.Engine) (err error) {
|
||||||
|
|
||||||
return sess.Commit()
|
return sess.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func cleanUpMigrateRepoInfo(x *xorm.Engine) (err error) {
|
||||||
|
type (
|
||||||
|
User struct {
|
||||||
|
ID int64 `xorm:"pk autoincr"`
|
||||||
|
LowerName string
|
||||||
|
}
|
||||||
|
Repository struct {
|
||||||
|
ID int64 `xorm:"pk autoincr"`
|
||||||
|
OwnerID int64
|
||||||
|
LowerName string
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
repos := make([]*Repository, 0, 25)
|
||||||
|
if err = x.Where("is_mirror=?", false).Find(&repos); err != nil {
|
||||||
|
return fmt.Errorf("select all non-mirror repositories: %v", err)
|
||||||
|
}
|
||||||
|
var user *User
|
||||||
|
for _, repo := range repos {
|
||||||
|
user = &User{ID: repo.OwnerID}
|
||||||
|
has, err := x.Get(user)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("get owner of repository[%d - %d]: %v", repo.ID, repo.OwnerID, err)
|
||||||
|
} else if !has {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
configPath := filepath.Join(setting.RepoRootPath, user.LowerName, repo.LowerName+".git/config")
|
||||||
|
cfg, err := ini.Load(configPath)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("open config file: %v", err)
|
||||||
|
}
|
||||||
|
cfg.DeleteSection("remote \"origin\"")
|
||||||
|
if err = cfg.SaveToIndent(configPath, "\t"); err != nil {
|
||||||
|
return fmt.Errorf("save config file: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.6.19.1031 Beta
|
0.6.20.1031 Beta
|
Loading…
Reference in a new issue