} // End Function HasChanges public virtual void UnleashHeavok(string path) { NGit.Api.Git repository = NGit.Api.Git.Open(path); // Get the current branch status NGit.Api.Status status = repository.Status().Call(); // You can also access other collections related to the status System.Collections.Generic.ICollection <string> added = status.GetAdded(); System.Collections.Generic.ICollection <string> changed = status.GetChanged(); System.Collections.Generic.ICollection <string> removed = status.GetRemoved(); // Clean our working copy System.Collections.Generic.ICollection <string> clean = repository.Clean().Call(); // Add all files to the stage (you could also be more specific) NGit.Dircache.DirCache add = repository.Add() .AddFilepattern(".") .Call(); // Remove files from the stage NGit.Dircache.DirCache remove = repository.Rm() .AddFilepattern(".gitignore") .Call(); CloseRepository(repository); } // End Sub UnleashHeavok
} // End Sub Pull public virtual void Status(string path) { NGit.Api.Git repository = NGit.Api.Git.Open(path); // Get the current branch status NGit.Api.Status status = repository.Status().Call(); CloseRepository(repository); } // End Sub Status
} // End Sub Status public virtual bool HasChanges(string path) { NGit.Api.Git repository = NGit.Api.Git.Open(path); // Get the current branch status NGit.Api.Status status = repository.Status().Call(); // The IsClean() method is helpful to check if any changes // have been detected in the working copy. I recommend using it, // as NGit will happily make a commit with no actual file changes. bool isClean = status.IsClean(); CloseRepository(repository); return(isClean); } // End Function HasChanges