AFAIK, commit hooks aren't yet implemented in JGit. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=299315
However, for examining the index, you can use the DirCache
class. DirCache.read(Repository) returns the index for the given repository. You can then either use a TreeWalk
to iterate over the entries or use getEntryCount() and getEntry().
You may also want to look at the unit tests to get further pointers on how to use the API.