JGit: Count objects
How can I retrieve the total number of git objects in a repository? (I search something like the git count-objects
in JGit.)
I made a Java program that calculates statistic values and has to read every object (blob, tree, commit, tag) of a git repository. Something like a progress bar should show the user how many objects already have been processed. So I need th开发者_StackOverflow中文版e total number of git objects.
I did not manipulate the Git objects at all, but I suppose you should explore the Repository object, which has methods like getAllRefs()
or getObjectDatabase()
.
From the results, I imagine you could find what you want.
精彩评论