From db0240319d68caefe41890273a1c97ed2422fb97 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Tue, 3 Jun 2014 23:30:40 +0200 Subject: [PATCH] Ensure Stage() detects minor changes in a tight loop --- LibGit2Sharp.Tests/StageFixture.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/LibGit2Sharp.Tests/StageFixture.cs b/LibGit2Sharp.Tests/StageFixture.cs index 3118a6237..9a6c6248a 100644 --- a/LibGit2Sharp.Tests/StageFixture.cs +++ b/LibGit2Sharp.Tests/StageFixture.cs @@ -372,5 +372,25 @@ public void CanStageConflictedIgnoredFiles(string filename, FileStatus expected) Assert.Equal(expected, repo.RetrieveStatus(filename)); } } + + [Fact] + public void CanSuccessfullyStageTheContentOfAModifiedFileOfTheSameSizeWithinTheSameSecond() + { + string repoPath = InitNewRepository(); + + using (var repo = new Repository(repoPath)) + { + for (int i = 0; i < 10; i++) + { + Touch(repo.Info.WorkingDirectory, "test.txt", + Guid.NewGuid().ToString()); + + repo.Stage("test.txt"); + + Assert.DoesNotThrow(() => repo.Commit( + "Commit", Constants.Signature, Constants.Signature)); + } + } + } } }