Skip to content

tree: allow for a tree limit in Tree::count_recursive#996

Merged
carlosmn merged 1 commit intolibgit2:masterfrom
carlosmn:cmn/count-tree-limit
Feb 22, 2026
Merged

tree: allow for a tree limit in Tree::count_recursive#996
carlosmn merged 1 commit intolibgit2:masterfrom
carlosmn:cmn/count-tree-limit

Conversation

@carlosmn
Copy link
Member

Sometimes you find yourself with a repository that not only has a lot of blobs but a lot of trees without many blobs in between. Such a repository can cause count_recursive to take a long time to return.

Allow for a second limit for the number of trees. If unset we use the limit for blobs which will not have any effect unless you have less than one blob per tree, which is roughly what we're trying to protect against here.

This issue was pointed out by #995

Sometimes you find yourself with a repository that not only has a lot of blobs
but a lot of trees without many blobs in between. Such a repository can cause
`count_recursive` to take a long time to return.

Allow for a second limit for the number of trees. If unset we use the limit for
blobs which will not have any effect unless you have less than one blob per
tree, which is roughly what we're trying to protect against here.
@carlosmn carlosmn merged commit 668ba59 into libgit2:master Feb 22, 2026
5 of 10 checks passed
@carlosmn carlosmn deleted the cmn/count-tree-limit branch February 22, 2026 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant