Hey JGit community. I am fairly new to JGit so forgive me if this question have been answered before but here is my situation.
I am trying to implement a way to get a list of revisions on a git repository based on include and exclude path filters that I give it.
So this is what I originally had in mind:
TreeFilter includeFilter = PathFilterGroup.createfromStrings(includePaths);
TreeFilter excludeFilter = NotTreeFilter.create(PathFilterGroup.createFromStrings(excludePaths));
TreeFilter pathFilter = AndTreeFilter.create(includeFilter, excludeFilter);
revWalk.setTreeFilter(pathFilter);
Now obviously this is just a simplified version that doesn’t take into account empty include and exclude path lists and the inclusion of the “/” in either list. But this is just an idea of what I was thinking.
After writing tests for this setup it wasn’t working and I came to the conclusion that I didn’t want the quick abort feature of PathFilterGroup so I switched to using something like this:
TreeFilter includeFilter = OrTreeFilter.create(includePathFiltersArray);
TreeFilter excludeFilter = NotTreeFilter.create(OrTreeFilter.create (excludePathFiltersArray));
TreeFilter pathFilter = AndTreeFilter.create(includeFilter, excludeFilter);
revWalk.setTreeFilter(pathFilter);
However now I am noticing that the Exclude Filter is not behaving as I would expect it to. I guess that makes sense as it seems that allot of these filters are not designed to handle the type of filter wrapping that I am trying to do.
It seems like the Exclude Filter doesn’t keep trying to filter recursively as I would expect it to.
I was looking for documentation on what I was trying to do but I couldn’t find anything. Does anyone have any ideas or resources that could help me out? Thanks for your time.
Evan Knapp
Software Engineer Int - PD,
JDA Software | 20700 Swenson Drive, Waukesha, WI 53186
1.262.317.2159
| office
1.480.308.3000 | worldwide
email |
Evan.Knapp@xxxxxxx
visit us | jda.com