2

I am designing a User interface in Java and I am trying to make my own buildbot like thing. So for that I want to create a function like buildbot's gitpoller in JGit. Is it possible?

pokche
  • 1,141
  • 12
  • 36

1 Answers1

2

Yes, it's possible. You can use a FetchCommand and then inspect the FetchResult. Something like this:

Repository repository = FileRepositoryBuilder.create(gitDir);
Git git = Git.wrap(repository);
FetchResult result = git.fetch().call();
for (TrackingRefUpdate refUpdate : result.getTrackingRefUpdates()) {
    // ...
}
robinst
  • 30,027
  • 10
  • 102
  • 108