#2569 delete repo local copy when transfer

Remote repository path is renamed but does not delete
outdated local copy which still has old repository path
as remote.
tokarchuk/v1.17
Unknwon 9 years ago
parent 29cd8ac270
commit 9adfe453d5
  1. 2
      .gopmfile
  2. 2
      README.md
  3. 2
      cmd/web.go
  4. 2
      gogs.go
  5. 6
      models/repo.go
  6. 2
      templates/.VERSION

@ -4,7 +4,7 @@ path = github.com/gogits/gogs
[deps] [deps]
github.com/bradfitz/gomemcache = commit:fb1f79c github.com/bradfitz/gomemcache = commit:fb1f79c
github.com/codegangsta/cli = commit:cf1f63a github.com/codegangsta/cli = commit:cf1f63a
github.com/go-macaron/binding = commit:2502aaf github.com/go-macaron/binding =
github.com/go-macaron/cache = commit:5617353 github.com/go-macaron/cache = commit:5617353
github.com/go-macaron/captcha = commit:8aa5919 github.com/go-macaron/captcha = commit:8aa5919
github.com/go-macaron/csrf = commit:715bca0 github.com/go-macaron/csrf = commit:715bca0

@ -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 version: 0.8.33 ##### Current version: 0.8.34
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

@ -81,7 +81,7 @@ func checkVersion() {
// Check dependency version. // Check dependency version.
checkers := []VerChecker{ checkers := []VerChecker{
{"github.com/go-xorm/xorm", func() string { return xorm.Version }, "0.4.4.1029"}, {"github.com/go-xorm/xorm", func() string { return xorm.Version }, "0.4.4.1029"},
{"github.com/go-macaron/binding", binding.Version, "0.1.0"}, {"github.com/go-macaron/binding", binding.Version, "0.2.1"},
{"github.com/go-macaron/cache", cache.Version, "0.1.2"}, {"github.com/go-macaron/cache", cache.Version, "0.1.2"},
{"github.com/go-macaron/csrf", csrf.Version, "0.0.3"}, {"github.com/go-macaron/csrf", csrf.Version, "0.0.3"},
{"github.com/go-macaron/i18n", i18n.Version, "0.2.0"}, {"github.com/go-macaron/i18n", i18n.Version, "0.2.0"},

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

@ -414,7 +414,7 @@ func (repo *Repository) ComposePayload() *api.PayloadRepo {
Email: repo.MustOwner().Email, Email: repo.MustOwner().Email,
UserName: repo.MustOwner().Name, UserName: repo.MustOwner().Name,
}, },
Private: repo.IsPrivate, Private: repo.IsPrivate,
DefaultBranch: repo.DefaultBranch, DefaultBranch: repo.DefaultBranch,
} }
} }
@ -1097,11 +1097,13 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error {
return fmt.Errorf("transferRepoAction: %v", err) return fmt.Errorf("transferRepoAction: %v", err)
} }
// Change repository directory name. // Rename remote repository to new path and delete local copy.
if err = os.Rename(RepoPath(owner.Name, repo.Name), RepoPath(newOwner.Name, repo.Name)); err != nil { if err = os.Rename(RepoPath(owner.Name, repo.Name), RepoPath(newOwner.Name, repo.Name)); err != nil {
return fmt.Errorf("rename repository directory: %v", err) return fmt.Errorf("rename repository directory: %v", err)
} }
RemoveAllWithNotice("Delete repository local copy", repo.LocalCopyPath())
// Rename remote wiki repository to new path and delete local copy.
wikiPath := WikiPath(owner.Name, repo.Name) wikiPath := WikiPath(owner.Name, repo.Name)
if com.IsExist(wikiPath) { if com.IsExist(wikiPath) {
RemoveAllWithNotice("Delete repository wiki local copy", repo.LocalWikiPath()) RemoveAllWithNotice("Delete repository wiki local copy", repo.LocalWikiPath())

@ -1 +1 @@
0.8.33.0210 0.8.34.0214
Loading…
Cancel
Save