I am trying to use IsClean() from NGit to determine if any changes have been detected in the working copy, it works fine but when I try to see if anything changed in remote I don't think IsClean() is the proper method to try. So I wanted to know if there is any other method that would help me to see the change made in remote. I tried pulling the remote repo but it doest seem to work, does anyone know if there is any method in NGit for this.
var repository = Git.Open(activeRepopath);
var status = repository.Status().Call();
Consoel.WriteLine(stauts.IsClean());
while (status.IsClean())
{
repository.Pull().Call();
}
I found the tutorial from here on IsClean().
I actually want something similar to buildbot's gitpoller. If someone could show me the way how to start I am happy to work in that direction.
In the solution you give yourself you are fetching the remote. That changes your local repository remote references, and may or may not be what you want. In this answer: How to know local repo is different from remote repo, without fetch? it is outlined how you can examine if the remote has changed with the
ls-remote
command, orLsRemote
with NGit in this case.Checking without fetching can look like this: