فهرست منبع

[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)
 	}