简体   繁体   中英

Is there a way to test if anyone pushed to the remote repo using JGit from local repo?

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?

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()) {
    // ...
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM