Skip to content

[Schema Inaccuracy] Commit compare endpoint limits the number of files returned #33

Closed

Description

@petewalker

Schema Inaccuracy

The /repos/{owner}/{repo}/compare/{base}...{head} endpoint has an undocumented limit on the number of files it returns (300).

Expected

There would either be no limit on the number of files returned, or there would be a way to paginate them.

Reproduction Steps

For example, see react/react@v16.10.2...v16.12.0 - there are 366 files changes between these 2 tags.

If you access the API:

$ curl -sS https://api.github.com/repos/facebook/react/compare/v16.10.2...v16.12.0 | jq -r '.files | length'

outputs

300

Only the first 300 files affected are returned in the response.

Activity

  1. ahoglund commented on Sep 2, 2020

    @ahoglund
    Contributor

    Thanks @petewalker, will take a look at this and if/how we can clarify this in the description.

  2. assigned and unassigned on Oct 6, 2020
  3. petewalker commented on Mar 24, 2021

    @petewalker
    Author
  4. craigpalermo commented on Mar 28, 2024

    @craigpalermo

    I noticed this today when working with the REST API via Octokit. The number of files returned in the first page of results even when using pagination is still limited to 300 and the documentation doesn't reflect this. The behavior also still exists in the repro example in the original issue. Is there an alternative way to get the full list of files for large comparisons?

  5. kylannjohnson commented on Apr 29, 2024

    @kylannjohnson

    This seems to still be an issue even with paging implemented. If I compare https://api.github.com/repos/OWNER/REPO/compare/... to its html equivalent, the html page gives 812 file changed with 4889 changes.

    If I summarize the response from the API, and I implement paging, I get 9 pages, but only one specifies files:

    Comparison -- 
    Page: total files: 300, total commits: 100
    Page: total files: 0, total commits: 100
    Page: total files: 0, total commits: 100
    Page: total files: 0, total commits: 100
    Page: total files: 0, total commits: 100
    Page: total files: 0, total commits: 100
    Page: total files: 0, total commits: 100
    Page: total files: 0, total commits: 100
    Page: total files: 0, total commits: 6
    

    According to the docs for comparison, "The list of changed files is only shown on the first page of results, but it includes all changed files for the entire comparison"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions