diff options
author | Unknwon <u@gogs.io> | 2015-09-01 09:29:52 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-01 09:29:52 -0400 |
commit | 8af094967fb0c09db817999bf8ff209251b183b8 (patch) | |
tree | 4af06f4e1ab2d1f30b4bb9da94cfc8ff1944a53e /routers/repo/setting.go | |
parent | f1adbca0f1e9aad55d23964cc95a8a42f0f66b1f (diff) | |
download | gitea-8af094967fb0c09db817999bf8ff209251b183b8.tar.gz gitea-8af094967fb0c09db817999bf8ff209251b183b8.zip |
#1377 add rename repo action
Diffstat (limited to 'routers/repo/setting.go')
-rw-r--r-- | routers/repo/setting.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 825b6c6f6b..d01b12645e 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -53,6 +53,7 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { return } + oldRepoName := repo.Name newRepoName := form.RepoName // Check if repository name has been changed. if repo.LowerName != strings.ToLower(newRepoName) { @@ -84,7 +85,10 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { visibilityChanged := repo.IsPrivate != form.Private repo.IsPrivate = form.Private if err := models.UpdateRepository(repo, visibilityChanged); err != nil { - ctx.Handle(404, "UpdateRepository", err) + ctx.Handle(500, "UpdateRepository", err) + return + } else if err = models.RenameRepoAction(ctx.User, oldRepoName, repo); err != nil { + ctx.Handle(500, "RenameRepoAction", err) return } log.Trace("Repository updated: %s/%s", ctx.Repo.Owner.Name, repo.Name) |