From 93485da29f724706ba90122a6c294e7c11856ade Mon Sep 17 00:00:00 2001 From: Porsh33 Date: Mon, 11 Apr 2022 15:45:36 +0300 Subject: [PATCH] fix(providers): Disable pagination of stash provider --- server/store/provider/provider.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/store/provider/provider.go b/server/store/provider/provider.go index 4b86ae9d..ca42267b 100644 --- a/server/store/provider/provider.go +++ b/server/store/provider/provider.go @@ -104,6 +104,16 @@ func (s providerStore) findRepos(id uint, page, size int) ([]*scm.Repository, er if err != nil { return repos, err } + + // git-scm does not work correctly with Stash pagination. + // Opened issue https://github.com/drone/go-scm/issues/166 + // See https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-rest.html + //> Identifiers of adjacent objects in a page may not be contiguous, + //> so the start of the next page is not necessarily the start of the last page plus the last page's size. + //> A client should always use nextPageStart to avoid unexpected results from a paged API. + if provider.Name == "stash" { + size = 1000 + } repos, err = gitscm.ListRepos(page, size) // Some providers like Stash don't return perms in ListRepos response