/// <summary> /// Run the diff operation. Until this is called, all lists will be empty /// </summary> /// <returns>true if anything is different between index, tree, and workdir</returns> public bool Diff() { DirectoryInfo root = _index.Repository.WorkingDirectory; var visitor = new AbstractIndexTreeVisitor { VisitEntry = delegate(TreeEntry treeEntry, GitIndex.Entry indexEntry, FileInfo file) { if (treeEntry == null) { Added.Add(indexEntry.Name); _anyChanges = true; } else if (indexEntry == null) { if (!(treeEntry is Tree)) { Removed.Add(treeEntry.FullName); } _anyChanges = true; } else { if (!treeEntry.Id.Equals(indexEntry.ObjectId)) { Changed.Add(indexEntry.Name); _anyChanges = true; } } if (indexEntry != null) { if (!file.Exists) { Missing.Add(indexEntry.Name); _anyChanges = true; } else { if (indexEntry.IsModified(root, true)) { Modified.Add(indexEntry.Name); _anyChanges = true; } } } } }; new IndexTreeWalker(_index, _tree, root, visitor).Walk(); CheckUntrackedDirectory(root.FullName, ""); return(_anyChanges); }