As per the get-tree API (GET /repos/:owner/:repo/git/trees/:tree_sha):
“If truncated is true, the number of items in the tree array exceeded our maximum limit. If you need to fetch more items, you can clone the repository and iterate over the Git data locally.”
Another online post mentions a GitHub API limit of 1,000 items per tree (https://github.com/websharks/wp-kb-articles/issues/76)
Is there an exact number of items allowed in a tree? If yes, how many?
An example I tried:
The root directory containing README.md, 4,000 files, and two subdirectories, containing 4,000 files each.
- ---- README.md
- ---- 4,000 files in /
- ---- /dir1
- -------- 4,000 files in /dir1
- ---- /dir2
- -------- 4,000 files in /dir2
Calling get-tree API is returning the whole list of 12,003 items, which makes the limit of 1,000 items not possible. The attribute “truncated” is always returned in the response with a value of false.
Another question for this example: If recursive was passed to the API with a value of 0, shouldn’t the response exclude the 8,000 files from the two subdirectories? Regardless if recursive is passed with a value of 0 or 1, it is always returning all files in the response.