count_recursive with a limit argument will hang if you run it in a "git bomb" repo that contains quadrillions of directories and not enough files to reach the limit.
This means the method can't really be used to enforce limits in code that runs on untrusted repos.