In libgit2sharp https://github.com/libgit2/libgit2sharp/ how do you check for pending/uncommitted changes?
The following works for me:
///DEPRECATED - see comment from @derptastic
public bool HasUncommittedChanges
{
get
{
using (var repo = new Repository(repositoryRoot))
{
RepositoryStatus status = repo.RetrieveStatus();
return status.IsDirty;
}
}
}
Thanks to @Derptastic for the link to LibGit2Sharp Wiki
The following lines of code will provide the filename and the state of that file.
foreach (var item in repo1.RetrieveStatus())
{
Console.WriteLine(item.FilePath);
Console.WriteLine(item.State);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With