Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Writing directory list method using JGit


Sorry, if it's not a correct place for the question.

I'm writing method that should list children of one tree in git repo. For each entry (file/dir) it must get info about last changed version, author, modification date (like github repo browser shows).
My implementation does the following:

1. Gets list of directory children (using TreeWalk). I will call this list <interesting paths>

2. Creating RevWalk. Traversing through commits and searching where each file was last changed. For every commit returned by RevWalk I create a TreeWalk for two trees: from current commit and from previous commit. This allows to find paths changed in current commit. If I find that one of <interesting paths> is changed between two commits I take commit info for that path.

Could you suggest some optimization for that? What can be the bottleneck in this implementation? This algorithm must be as fast as possible. I think comparing paths in tree traversal takes lot of time, but have no idea how to improve it.

Thanks in advance,

Ilya Ivanov,
Java Software Developer
Follow @intland on Twitter:

Back to the top