libgit2sharp https://github.com/libgit2/libgit2sharp/では、保留中/コミットされていない変更をどのように確認しますか?
5560 次
3 に答える
19
以下は私にとってはうまくいきます:
///DEPRECATED - see comment from @derptastic
public bool HasUncommittedChanges
{
get
{
using (var repo = new Repository(repositoryRoot))
{
RepositoryStatus status = repo.RetrieveStatus();
return status.IsDirty;
}
}
}
LibGit2Sharp Wikiへのリンクを提供してくれた @Derptastic に感謝します。
于 2015-05-18T19:51:13.047 に答える
5
使用できますrepository.Diff.Compare()
。
/// <summary>
/// Show changes between the working directory and the index.
/// </summary>
/// <param name = "paths">The list of paths (either files or directories) that should be compared.</param>
/// <returns>A <see cref = "TreeChanges"/> containing the changes between the working directory and the index.</returns>
public virtual TreeChanges Compare(IEnumerable<string> paths = null)
パスをまったく渡さないと、すべての変更が行われます。
于 2012-10-13T13:32:13.500 に答える