|
|
@ -12,6 +12,7 @@ import ( |
|
|
|
"code.gitea.io/gitea/models/perm" |
|
|
|
"code.gitea.io/gitea/models/perm" |
|
|
|
repo_model "code.gitea.io/gitea/models/repo" |
|
|
|
repo_model "code.gitea.io/gitea/models/repo" |
|
|
|
user_model "code.gitea.io/gitea/models/user" |
|
|
|
user_model "code.gitea.io/gitea/models/user" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/notification" |
|
|
|
"code.gitea.io/gitea/modules/notification" |
|
|
|
"code.gitea.io/gitea/modules/sync" |
|
|
|
"code.gitea.io/gitea/modules/sync" |
|
|
|
) |
|
|
|
) |
|
|
@ -57,6 +58,8 @@ func TransferOwnership(doer, newOwner *user_model.User, repo *repo_model.Reposit |
|
|
|
|
|
|
|
|
|
|
|
// ChangeRepositoryName changes all corresponding setting from old repository name to new one.
|
|
|
|
// ChangeRepositoryName changes all corresponding setting from old repository name to new one.
|
|
|
|
func ChangeRepositoryName(doer *user_model.User, repo *repo_model.Repository, newRepoName string) error { |
|
|
|
func ChangeRepositoryName(doer *user_model.User, repo *repo_model.Repository, newRepoName string) error { |
|
|
|
|
|
|
|
log.Trace("ChangeRepositoryName: %s/%s -> %s", doer.Name, repo.Name, newRepoName) |
|
|
|
|
|
|
|
|
|
|
|
oldRepoName := repo.Name |
|
|
|
oldRepoName := repo.Name |
|
|
|
|
|
|
|
|
|
|
|
// Change repository directory name. We must lock the local copy of the
|
|
|
|
// Change repository directory name. We must lock the local copy of the
|
|
|
@ -70,6 +73,7 @@ func ChangeRepositoryName(doer *user_model.User, repo *repo_model.Repository, ne |
|
|
|
} |
|
|
|
} |
|
|
|
repoWorkingPool.CheckOut(fmt.Sprint(repo.ID)) |
|
|
|
repoWorkingPool.CheckOut(fmt.Sprint(repo.ID)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repo.Name = newRepoName |
|
|
|
notification.NotifyRenameRepository(doer, repo, oldRepoName) |
|
|
|
notification.NotifyRenameRepository(doer, repo, oldRepoName) |
|
|
|
|
|
|
|
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|