소스 검색

[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 년 전
부모
커밋
33c3b62c3f
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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)
 	}