@@ -84,31 +84,43 @@ func (s *gitService) ListBranches(ctx context.Context, repo string, opts scm.Lis
8484 path := fmt .Sprintf ("2.0/repositories/%s/refs/branches?%s" , repo , encodeListOptions (opts ))
8585 out := new (branches )
8686 res , err := s .client .do (ctx , "GET" , path , nil , out )
87- copyPagination (out .pagination , res )
87+ if err != nil {
88+ return nil , res , err
89+ }
90+ err = copyPagination (out .pagination , res )
8891 return convertBranchList (out ), res , err
8992}
9093
9194func (s * gitService ) ListCommits (ctx context.Context , repo string , opts scm.CommitListOptions ) ([]* scm.Commit , * scm.Response , error ) {
9295 path := fmt .Sprintf ("2.0/repositories/%s/commits/%s?%s" , repo , opts .Ref , encodeCommitListOptions (opts ))
9396 out := new (commits )
9497 res , err := s .client .do (ctx , "GET" , path , nil , out )
95- copyPagination (out .pagination , res )
98+ if err != nil {
99+ return nil , res , err
100+ }
101+ err = copyPagination (out .pagination , res )
96102 return convertCommitList (out ), res , err
97103}
98104
99105func (s * gitService ) ListTags (ctx context.Context , repo string , opts scm.ListOptions ) ([]* scm.Reference , * scm.Response , error ) {
100106 path := fmt .Sprintf ("2.0/repositories/%s/refs/tags?%s" , repo , encodeListOptions (opts ))
101107 out := new (branches )
102108 res , err := s .client .do (ctx , "GET" , path , nil , & out )
103- copyPagination (out .pagination , res )
109+ if err != nil {
110+ return nil , res , err
111+ }
112+ err = copyPagination (out .pagination , res )
104113 return convertTagList (out ), res , err
105114}
106115
107116func (s * gitService ) ListChanges (ctx context.Context , repo , ref string , opts scm.ListOptions ) ([]* scm.Change , * scm.Response , error ) {
108117 path := fmt .Sprintf ("2.0/repositories/%s/diffstat/%s?%s" , repo , ref , encodeListOptions (opts ))
109118 out := new (diffstats )
110119 res , err := s .client .do (ctx , "GET" , path , nil , & out )
111- copyPagination (out .pagination , res )
120+ if err != nil {
121+ return nil , res , err
122+ }
123+ err = copyPagination (out .pagination , res )
112124 return convertDiffstats (out ), res , err
113125}
114126
0 commit comments