Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: CompareResults.File limited to 300 maximum files? #2763

Open
1 task done
CaseyChester opened this issue Aug 17, 2023 · 2 comments
Open
1 task done

[BUG]: CompareResults.File limited to 300 maximum files? #2763

CaseyChester opened this issue Aug 17, 2023 · 2 comments
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs

Comments

@CaseyChester
Copy link

What happened?

The documentation for RepositoryCommitsClient.Compare function indicate that all files included in the compare are returned in the first paginated response. As far as I can tell, the maximum number of files returned is 300, which are returned in the first response, but there is no way to retrieve the remainder of the files for comparisons that include more than 300 files. Not sure if this is a bug or a limitation 'by design'.

Versions

Octokit.net version 7.1.0

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@CaseyChester CaseyChester added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Aug 17, 2023
@nickfloyd nickfloyd added Type: Support Any questions, information, or general needs around the SDK or GitHub APIs and removed Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Aug 18, 2023
@nickfloyd
Copy link
Contributor

Hey @CaseyChester thanks for reaching out! ❤️

If I am understanding you're use case correctly, you should be able to use the following interface and pass in APIOptions:

Task<CompareResult> Compare(string owner, string name, string @base, string head, ApiOptions options);

So it might look something like in a loop or some sort of iteration:

var options = new ApiOptions
 {
     PageSize = 100,
     PageCount = 1,
    StartPage = 1
};

var commits = await  client.Compare(string "owner", "repo_name", "base", "head", options);

Also, the REST API docs on comparing commits says the limit is 250. I'll let our docs folks know that you are seeing 300 so that we can get that corrected and up to date.

Let us know if this approach works for you!

@dbalatero
Copy link

dbalatero commented Jan 18, 2024

@nickfloyd I've seen the pagination thing in multiple responses on this issue across various GitHub-related repos, but from my testing, it seems that the pagination applies to commits, not files.

If you have a commit range with only 2 commits in it (which is under the 100 per page limit), but 5000 files:

  • page 1 will return 2 commits, and 300 max files
  • page 2 will return 0 commits, because there aren't more than 100, and 0 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs
Projects
Status: 🛑 Blocked/Awaiting Response
Development

No branches or pull requests

3 participants