Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » JGIT check if entry matches gitignore rules
JGIT check if entry matches gitignore rules [message #1769210] Thu, 27 July 2017 19:30 Go to next message
harry rajan is currently offline harry rajanFriend
Messages: 6
Registered: October 2012
Junior Member

I am using ObjectInserter and TreeFormatter apis to build a git repository as per this website (

How do i check if a file entry matches the rules of gitignore/exclude files before inserting into the object database? I see IgnoreNode and FastIgnoreRules apis but these are constructed internally in the FileTreeIterator.

Re: JGIT check if entry matches gitignore rules [message #1769245 is a reply to message #1769210] Fri, 28 July 2017 07:59 Go to previous message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 257
Registered: July 2009
Senior Member
You are sure that you don't want a FileTreeIterator and a TreeWalk? Problem is that .gitignore files can exist in any folder of the working tree. And you have to interprete and merge together all gitignores you find in the current dir and in all dirs upon you (and is has to be merged with global .gitignores in $HOME, /etc/,...). That's why a computation of the effective gitignore rules is done inside a Walk and an WalkIterator.

The same is true for attributes. You have to compute effective set of gitattributes to compute e.g. whether a file should be treated as binary or cr/lf conversion has to be done.

Previous Topic:How to fetch one commit by Jgit?
Next Topic:Super slow right click on branch in history window
Goto Forum:

Current Time: Fri Oct 19 05:26:43 GMT 2018

Powered by FUDForum. Page generated in 0.01967 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top