diff options
author | Unknwon <u@gogs.io> | 2016-02-14 19:42:38 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-14 19:42:38 -0500 |
commit | 9adfe453d506fa7ea18b2df3871f72b5c4dc9b7c (patch) | |
tree | be2dc269603c5a360199c676b44c7f74a708b55c /models | |
parent | 29cd8ac270603ff3a5d02134e7c46ae5006844bd (diff) | |
download | gitea-9adfe453d506fa7ea18b2df3871f72b5c4dc9b7c.tar.gz gitea-9adfe453d506fa7ea18b2df3871f72b5c4dc9b7c.zip |
#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.
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/models/repo.go b/models/repo.go index 46b25a017f..4a8c8f0546 100644 --- a/models/repo.go +++ b/models/repo.go @@ -414,7 +414,7 @@ func (repo *Repository) ComposePayload() *api.PayloadRepo { Email: repo.MustOwner().Email, UserName: repo.MustOwner().Name, }, - Private: repo.IsPrivate, + Private: repo.IsPrivate, DefaultBranch: repo.DefaultBranch, } } @@ -1097,11 +1097,13 @@ func TransferOwnership(u *User, newOwnerName string, repo *Repository) error { 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 { 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) if com.IsExist(wikiPath) { RemoveAllWithNotice("Delete repository wiki local copy", repo.LocalWikiPath()) |