From e7120887a973fe8007d0c13d89621cc0ab98cbf8 Mon Sep 17 00:00:00 2001 From: Albert Meltzer Date: Tue, 3 Jun 2014 11:15:12 -0700 Subject: [PATCH] Test making two successive commits to same file. This test fails on Windows and on the Mac. --- LibGit2Sharp.Tests/CommitFixture.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/LibGit2Sharp.Tests/CommitFixture.cs b/LibGit2Sharp.Tests/CommitFixture.cs index e372fd7d2..0ed4fc7eb 100644 --- a/LibGit2Sharp.Tests/CommitFixture.cs +++ b/LibGit2Sharp.Tests/CommitFixture.cs @@ -902,6 +902,28 @@ public void CanNotCommitAnEmptyCommit() } } + private static void WriteAndCommit(Repository repo, string filename, string text) + { + File.WriteAllText(filename, text); + repo.Index.Stage("*"); + repo.Commit(filename, Constants.Signature, Constants.Signature); + } + + [Fact] + public void CanCommitTwoCommitsInARow() + { + string path = CloneStandardTestRepo(); + using (var repo = new Repository(path)) + { + repo.Reset(ResetMode.Hard); + repo.RemoveUntrackedFiles(); + + var filename = Path.Combine(path, Path.GetRandomFileName()); + Assert.DoesNotThrow(() => WriteAndCommit(repo, filename, "a")); + Assert.DoesNotThrow(() => WriteAndCommit(repo, filename, "b")); + } + } + [Fact] public void CanCommitAnEmptyCommitWhenForced() {