Skip to content

Commit

Permalink
Merge pull request #1350 from mrpinsky/mrpinsky/paginated-compare
Browse files Browse the repository at this point in the history
Support pagination in `compare`
  • Loading branch information
tarebyte authored Aug 2, 2021
2 parents be7c105 + f8f1293 commit 605a08a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/octokit/client/commits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,18 @@ def create_commit(repo, message, tree, parents=nil, options = {})

# Compare two commits
#
# When using auto_pagination, commits from all pages will be concatenated
# into the <tt>commits</tt> attribute of the first page's response.
#
# @param repo [Integer, String, Hash, Repository] A GitHub repository
# @param start [String] The sha of the starting commit
# @param endd [String] The sha of the ending commit
# @return [Sawyer::Resource] A hash representing the comparison
# @see https://developer.github.com/v3/repos/commits/#compare-two-commits
def compare(repo, start, endd, options = {})
get "#{Repository.path repo}/compare/#{start}...#{endd}", options
paginate "#{Repository.path repo}/compare/#{start}...#{endd}", options do |data, last_response|
data.commits.concat last_response.data.commits
end
end

# Merge a branch or sha
Expand Down
Loading

0 comments on commit 605a08a

Please sign in to comment.