You can register listeners through JGit for all repositories or individual repositories using the following methods:
Global listeners are notified of all repositories:
org.eclipse.jgit.lib.Repository.getGlobalListenerList().addIndexChangedListener
org.eclipse.jgit.lib.Repository.getGlobalListenerList().addConfigChangedListener
org.eclipse.jgit.lib.Repository.getGlobalListenerList().addRefsChangedListener
Listeners in an invisible repository:
org.eclipse.jgit.lib.Repository.getListenerList().addIndexChangedListener
org.eclipse.jgit.lib.Repository.getListenerList().addConfigChangedListener
org.eclipse.jgit.lib.Repository.getListenerList().addRefsChangedListener
These listeners support events for changing the index, changing the configuration of the repository, and changing links to repositories (branches, tags, etc.).
You can find all repositories registered with EGit as follows:
Get absolute paths to all repositories present in EGit by calling:
org.eclipse.egit.core.Activator.getDefault().getRepositoryUtil().getConfiguredRepositories()
You can get the handle to a specific repository object by creating a file for the path returned from the previous method, and then call the following using this file:
org.eclipse.egit.core.Activator.getDefault().getRepositoryCache().lookupRepository
source
share