@@ -64,10 +64,7 @@ func (s *gitService) ListBranches(ctx context.Context, repo string, opts scm.Lis
6464 path := fmt .Sprintf ("rest/api/1.0/projects/%s/repos/%s/branches?%s" , namespace , name , encodeListOptions (opts ))
6565 out := new (branches )
6666 res , err := s .client .do (ctx , "GET" , path , nil , out )
67- if ! out .pagination .LastPage .Bool {
68- res .Page .First = 1
69- res .Page .Next = opts .Page + 1
70- }
67+ copyPagination (out .pagination , res )
7168 return convertBranchList (out ), res , err
7269}
7370
@@ -79,35 +76,26 @@ func (s *gitService) ListTags(ctx context.Context, repo string, opts scm.ListOpt
7976 namespace , name := scm .Split (repo )
8077 path := fmt .Sprintf ("rest/api/1.0/projects/%s/repos/%s/tags?%s" , namespace , name , encodeListOptions (opts ))
8178 out := new (branches )
82- res , err := s .client .do (ctx , "GET" , path , nil , & out )
83- if ! out .pagination .LastPage .Bool {
84- res .Page .First = 1
85- res .Page .Next = opts .Page + 1
86- }
79+ res , err := s .client .do (ctx , "GET" , path , nil , out )
80+ copyPagination (out .pagination , res )
8781 return convertTagList (out ), res , err
8882}
8983
9084func (s * gitService ) ListChanges (ctx context.Context , repo , ref string , opts scm.ListOptions ) ([]* scm.Change , * scm.Response , error ) {
9185 namespace , name := scm .Split (repo )
9286 path := fmt .Sprintf ("rest/api/1.0/projects/%s/repos/%s/commits/%s/changes?%s" , namespace , name , ref , encodeListOptions (opts ))
9387 out := new (diffstats )
94- res , err := s .client .do (ctx , "GET" , path , nil , & out )
95- if ! out .pagination .LastPage .Bool {
96- res .Page .First = 1
97- res .Page .Next = opts .Page + 1
98- }
88+ res , err := s .client .do (ctx , "GET" , path , nil , out )
89+ copyPagination (out .pagination , res )
9990 return convertDiffstats (out ), res , err
10091}
10192
10293func (s * gitService ) CompareChanges (ctx context.Context , repo , source , target string , opts scm.ListOptions ) ([]* scm.Change , * scm.Response , error ) {
10394 namespace , name := scm .Split (repo )
10495 path := fmt .Sprintf ("rest/api/1.0/projects/%s/repos/%s/compare/changes?from=%s&to=%s&%s" , namespace , name , source , target , encodeListOptions (opts ))
10596 out := new (diffstats )
106- res , err := s .client .do (ctx , "GET" , path , nil , & out )
107- if ! out .pagination .LastPage .Bool {
108- res .Page .First = 1
109- res .Page .Next = opts .Page + 1
110- }
97+ res , err := s .client .do (ctx , "GET" , path , nil , out )
98+ copyPagination (out .pagination , res )
11199 return convertDiffstats (out ), res , err
112100}
113101
0 commit comments