Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[egit-dev] Finding the ObjectID of a subfolder in a repository

Sorry if this is a dumb question - I've searched around a fair amount.

I'd like to run a status of a subfolder using jgit.  I can get the
status of the whole project using code similar to
http://github.com/sonatype/JGit/blob/1f9dac50f0743b710f95f6370fa801bbac28c4cf/org.spearce.jgit/src/org/spearce/jgit/simple/SimpleRepository.java#L722

But what is the best way to filter out a subfolder?

The relevant code is:

mTreeWalk = new TreeWalk(mRepo);
mRevWalk = new RevWalk(mRepo);
mTreeWalk.addTree(new FileTreeIterator(aRootFolder));
mTreeWalk.addTree(mRevWalk.parseTree(mRepo.resolve(Constants.HEAD)));
(I'm ignoring the index for now)

The TreeWalk javadoc says all trees must have the same root.  That
works great for my FileTreeIterator, but what about the repository
tree?  How do I get the ObjectID for the subtree, instead of just for
HEAD?

Thanks!!
Brad


Back to the top