summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-03 06:48:52 -0400
committerUnknwon <u@gogs.io>2015-09-03 06:48:52 -0400
commit7ec991326d550957b278475057965e197f6e0324 (patch)
tree1e1972d0a1c92296d1c88ce855780bfc545bac83
parente5b105e513cb8bfe728c451525d1d9fd7d0979eb (diff)
downloadgitea-7ec991326d550957b278475057965e197f6e0324.tar.gz
gitea-7ec991326d550957b278475057965e197f6e0324.zip
fix migrate api
-rw-r--r--cmd/web.go1
-rw-r--r--modules/auth/repo_form.go16
-rw-r--r--routers/api/v1/repo.go2
3 files changed, 9 insertions, 10 deletions
diff --git a/cmd/web.go b/cmd/web.go
index c2658a5cee..45df560765 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -236,7 +236,6 @@ func runWeb(ctx *cli.Context) {
m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.MigrateRepo)
}, middleware.ApiReqToken())
- // TODO: https://github.com/gogits/go-gogs-client/wiki
m.Group("/:username/:reponame", func() {
m.Combo("/hooks").Get(v1.ListRepoHooks).
Post(bind(api.CreateHookOption{}), v1.CreateRepoHook)
diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go
index 4d90074386..d051aed424 100644
--- a/modules/auth/repo_form.go
+++ b/modules/auth/repo_form.go
@@ -32,14 +32,14 @@ func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) bin
}
type MigrateRepoForm struct {
- CloneAddr string `binding:"Required"`
- AuthUsername string
- AuthPassword string
- Uid int64 `binding:"Required"`
- RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
- Private bool
- Mirror bool
- Description string `binding:"MaxSize(255)"`
+ CloneAddr string `json:"clone_addr" binding:"Required"`
+ AuthUsername string `json:"auth_username"`
+ AuthPassword string `json:"auth_password"`
+ Uid int64 `json:"uid" binding:"Required"`
+ RepoName string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
+ Private bool `json:"mirror"`
+ Mirror bool `json:"private"`
+ Description string `json:"description" binding:"MaxSize(255)"`
}
func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
diff --git a/routers/api/v1/repo.go b/routers/api/v1/repo.go
index 07d836e5b3..d38a0b0ff2 100644
--- a/routers/api/v1/repo.go
+++ b/routers/api/v1/repo.go
@@ -251,5 +251,5 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
}
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
- ctx.WriteHeader(200)
+ ctx.JSON(201, ToApiRepository(ctxUser, repo, api.Permission{true, true, true}))
}