diff options
author | Kyle Evans <kevans91@users.noreply.github.com> | 2021-08-28 03:37:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-28 16:37:14 +0800 |
commit | cad70599a65894651d91ad230b57857a443a4d26 (patch) | |
tree | 81181d7a44f8dd3f15234ca4ec28b03f1ff4187b /routers | |
parent | 19049413827b130809ffe249900a5c89ef8a90df (diff) | |
download | gitea-cad70599a65894651d91ad230b57857a443a4d26.tar.gz gitea-cad70599a65894651d91ad230b57857a443a4d26.zip |
Refactor the fork service slightly to take ForkRepoOptions (#16744)
* Refactor the fork service slightly to take ForkRepoOptions
This reduces the number of places we need to change if we want to add other
options during fork time.
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* Fix integrations and tests after ForkRepository refactor
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* Update OldRepo -> BaseRepo
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
* gofmt pass
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/fork.go | 6 | ||||
-rw-r--r-- | routers/web/repo/pull.go | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/routers/api/v1/repo/fork.go b/routers/api/v1/repo/fork.go index a3f9aa14f9..b3504faad9 100644 --- a/routers/api/v1/repo/fork.go +++ b/routers/api/v1/repo/fork.go @@ -123,7 +123,11 @@ func CreateFork(ctx *context.APIContext) { forker = org } - fork, err := repo_service.ForkRepository(ctx.User, forker, repo, repo.Name, repo.Description) + fork, err := repo_service.ForkRepository(ctx.User, forker, models.ForkRepoOptions{ + BaseRepo: repo, + Name: repo.Name, + Description: repo.Description, + }) if err != nil { ctx.Error(http.StatusInternalServerError, "ForkRepository", err) return diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 2fa5ab9186..a41c9eb2b4 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -225,7 +225,11 @@ func ForkPost(ctx *context.Context) { } } - repo, err := repo_service.ForkRepository(ctx.User, ctxUser, forkRepo, form.RepoName, form.Description) + repo, err := repo_service.ForkRepository(ctx.User, ctxUser, models.ForkRepoOptions{ + BaseRepo: forkRepo, + Name: form.RepoName, + Description: form.Description, + }) if err != nil { ctx.Data["Err_RepoName"] = true switch { |