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() {