Exemple #1
0
 public void GetLastFileCommit() {
     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,gh.GetFileCommit(file).Hash);
     Assert.AreEqual(secCommit,gh.GetFileCommit(file2).Hash);
 }