diff options
Diffstat (limited to 'models/repo/update.go')
-rw-r--r-- | models/repo/update.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/models/repo/update.go b/models/repo/update.go index efc562a40..a0c38ed1b 100644 --- a/models/repo/update.go +++ b/models/repo/update.go @@ -165,6 +165,18 @@ func ChangeRepositoryName(doer *user_model.User, repo *Repository, newRepoName s } } + projectBasePath := repo.ProjectBasePath() + isExist, err = util.IsExist(projectBasePath) + if err != nil { + log.Error("Unable to check if %s exists. Error: %v", projectBasePath, err) + return err + } + if isExist { + if err = util.Rename(projectBasePath, ProjectBasePath(repo.Owner.Name, newRepoName)); err != nil { + return fmt.Errorf("rename repository projectbase: %v", err) + } + } + ctx, committer, err := db.TxContext() if err != nil { return err |