I am trying to use jGit to get all commits in a repository, not just the ones I can reach via heads or tags, but all the ones that were not yet garbage collected. Is there a way to do this with jGit in an efficient manner?
Update to better describe the actual use-case
I am working on a FUSE based filesystem which provides a filesystem-view of the Git history, see https://github.com/centic9/JGitFS/ for a first version (Linux/Mac only).
With this I am providing "virtual" sub-directories for commits, i.e. I am creating a directory structure like the following
/commit
00
abcd..
bcde..
ae
bdas..
And beneath the commit-id the virtual filesystem provides the source-files "as-of" that commit.
Refs/Tags are provided as symbolic links to the actual commit the HEAD of that ref/tag:
/branch
master -> ../commit/00/abcd...
bugfix -> ../commit/ae/bdas...
/tag
version_1 -> ../commit/00/bcde...
In order to make this filesystem fast, I need a way to iterate all commits in a repository very quickly. Looking at each tag and ref separately as I do now is sub-optimal as this way I look at the same commits many times if refs share a common history (which they do almost always!).
Preferably I would like to get a simple list of all commits that are still available, not just ones that are part of a branch, this way you can even look at versions that are not reachable any more by refs/tags.