aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/fork.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/repository/fork.go')
-rw-r--r--services/repository/fork.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/repository/fork.go b/services/repository/fork.go
index 3ed0f4ffa5..ad534be887 100644
--- a/services/repository/fork.go
+++ b/services/repository/fork.go
@@ -51,6 +51,13 @@ type ForkRepoOptions struct {
// ForkRepository forks a repository
func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts ForkRepoOptions) (*repo_model.Repository, error) {
+ // Fork is prohibited, if user has reached maximum limit of repositories
+ if !owner.CanForkRepo() {
+ return nil, repo_model.ErrReachLimitOfRepo{
+ Limit: owner.MaxRepoCreation,
+ }
+ }
+
forkedRepo, err := repo_model.GetUserFork(ctx, opts.BaseRepo.ID, owner.ID)
if err != nil {
return nil, err