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:
Kyle Evans 2021-08-28 03:37:14 -05:00 committed by GitHub
parent 1904941382
commit cad70599a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 46 additions and 23 deletions

View file

@ -1004,6 +1004,13 @@ type CreateRepoOptions struct {
MirrorInterval string
}
// ForkRepoOptions contains the fork repository options
type ForkRepoOptions struct {
BaseRepo *Repository
Name string
Description string
}
// GetRepoInitFile returns repository init files
func GetRepoInitFile(tp, name string) ([]byte, error) {
cleanedName := strings.TrimLeft(path.Clean("/"+name), "/")