/// <summary> /// Инициализирует репозиторий в указанной папке /// </summary> /// <param name="dir"></param> public static void Init(string dir) { var gh = new GitHelper { DirectoryName = dir }; gh.Init(); }
public void StaticGetLastFileCommit() { var dir = FileSystemHelper.ResetTemporaryDirectory(); var gh = new GitHelper { DirectoryName = dir }; Directory.CreateDirectory(Path.Combine(dir, "a")); var file = Path.Combine(dir, "a", "x"); File.WriteAllText(file, "zzz"); var file2 = Path.Combine(dir, "a", "y"); File.WriteAllText(file2, "zzz2"); gh.Init(); gh.CommitAllChanges(); var fstCommit = gh.GetCommitId(); File.WriteAllText(file2, "zzz3"); gh.CommitAllChanges(); var secCommit = gh.GetCommitId(); Assert.AreEqual(fstCommit, GitHelper.GetLastCommit(file).Hash); Assert.AreEqual(secCommit, GitHelper.GetLastCommit(file2).Hash); }
public void StaticGetCommit() { var dir = FileSystemHelper.ResetTemporaryDirectory(); Directory.CreateDirectory(Path.Combine(dir, "a")); var file = Path.Combine(dir, "a", "x"); File.WriteAllText(file,"zzz"); Assert.Null(GitHelper.GetCommit(file)); var gh = new GitHelper {DirectoryName = dir}; gh.Init(); var hash = gh.CommitAllChanges(); Assert.AreEqual(hash, GitHelper.GetCommit(file).Hash); }
/// <summary> /// Инициализирует репозиторий в указанной папке /// </summary> /// <param name="dir"></param> public static void Init(string dir) { var gh = new GitHelper {DirectoryName = dir}; gh.Init(); }