Browse Source

[api] Deep forking should be possible

With forks deeper then 1 (meaning forks of forks) the api breaks as it will
recursively ask for parents which in turn have not been fetched from the db.

Limiting the depth of the parent retrieval works around this.
cgars 7 years ago
parent
commit
33c3b62c3f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      models/repo.go

+ 1 - 1
models/repo.go

@@ -311,7 +311,7 @@ func (repo *Repository) APIFormat(permission *api.Permission) *api.Repository {
 		Updated:       repo.Updated,
 		Permissions:   permission,
 	}
-	if repo.IsFork {
+	if repo.IsFork && repo.BaseRepo != nil {
 		// FIXME: check precise permission for base repository
 		apiRepo.Parent = repo.BaseRepo.APIFormat(nil)
 	}