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>
This commit is contained in:
parent
1904941382
commit
cad70599a6
7 changed files with 46 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue