aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-10-31 23:18:58 -0400
committerUnknwon <u@gogs.io>2015-10-31 23:18:58 -0400
commitcb100c7781699dec7987d349590411917d3dff44 (patch)
tree484a48b12717130360a82f2f10575c22a3f5e5fc
parent5cad12470456fce715b9d94681d82bd46864d44c (diff)
work #1705
-rw-r--r--conf/locale/TRANSLATORS4
-rw-r--r--gogs.go2
-rw-r--r--models/migrations/migrations.go43
-rw-r--r--templates/.VERSION2
4 files changed, 48 insertions, 3 deletions
diff --git a/conf/locale/TRANSLATORS b/conf/locale/TRANSLATORS
index 7c6eb0ba..8e6cbc2e 100644
--- a/conf/locale/TRANSLATORS
+++ b/conf/locale/TRANSLATORS
@@ -17,4 +17,6 @@ Luc Stepniewski <luc@stepniewski.fr>
Miguel de la Cruz <miguel@mcrx.me>
Marc Schiller <marc@schiller.im>
Morten Sørensen <klim8d@gmail.com>
-Natan Albuquerque <natanalbuquerque5@gmail.com> \ No newline at end of file
+Natan Albuquerque <natanalbuquerque5@gmail.com>
+Odilon Junior <odilon.junior93@gmail.com>
+YJSoft <yjsoft@yjsoft.pe.kr> \ No newline at end of file
diff --git a/gogs.go b/gogs.go
index 420bb3a6..3d46bb95 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.6.19.1031 Beta"
+const APP_VER = "0.6.20.1031 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index c3f7a59b..df1e4a2d 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -11,6 +11,7 @@ import (
"io/ioutil"
"os"
"path"
+ "path/filepath"
"strings"
"time"
@@ -66,6 +67,7 @@ var migrations = []Migration{
NewMigration("generate issue-label from issue", issueToIssueLabel), // V6 -> V7: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("clean up migrate repo info", cleanUpMigrateRepoInfo), // V9 -> V10:v0.6.20
}
// Migrate database to current version
@@ -653,3 +655,44 @@ func renamePullRequestFields(x *xorm.Engine) (err error) {
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
+}
diff --git a/templates/.VERSION b/templates/.VERSION
index 621edbbe..51973bc4 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.6.19.1031 Beta \ No newline at end of file
+0.6.20.1031 Beta \ No newline at end of file