diff options
author | Unknwon <u@gogs.io> | 2015-10-31 23:22:28 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-10-31 23:22:28 -0400 |
commit | 04806b614e64619828abc6e37b83659304323e7e (patch) | |
tree | fa54109eef5f914f97a170e6e5d20d5443888464 /models/repo.go | |
parent | cb100c7781699dec7987d349590411917d3dff44 (diff) | |
download | gitea-04806b614e64619828abc6e37b83659304323e7e.tar.gz gitea-04806b614e64619828abc6e37b83659304323e7e.zip |
more on #1705
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index 197415c624..5f19159f57 100644 --- a/models/repo.go +++ b/models/repo.go @@ -23,6 +23,7 @@ import ( "github.com/Unknwon/cae/zip" "github.com/Unknwon/com" "github.com/go-xorm/xorm" + "gopkg.in/ini.v1" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/bindata" @@ -537,6 +538,17 @@ func MigrateRepository(u *User, opts MigrateRepoOptions) (*Repository, error) { return repo, fmt.Errorf("create update hook: %v", err) } + // Clean up mirror info which prevents "push --all". + configPath := filepath.Join(repoPath, "/config") + cfg, err := ini.Load(configPath) + if err != nil { + return repo, fmt.Errorf("open config file: %v", err) + } + cfg.DeleteSection("remote \"origin\"") + if err = cfg.SaveToIndent(configPath, "\t"); err != nil { + return repo, fmt.Errorf("save config file: %v", err) + } + // Check if repository is empty. _, stderr, err = com.ExecCmdDir(repoPath, "git", "log", "-1") if err != nil { |