Skip to content

Commit 472eb2c

Browse files
committed
Ensure Stage() detects minor changes in a tight loop
1 parent b70d403 commit 472eb2c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

LibGit2Sharp.Tests/StageFixture.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,5 +330,25 @@ public void CanStageIgnoredPaths(string path)
330330
Assert.Equal(FileStatus.Added, repo.Index.RetrieveStatus(path));
331331
}
332332
}
333+
334+
[Fact]
335+
public void CanSuccessfullyStageTheContentOfAModifiedFileOfTheSameSizeWithinTheSameSecond()
336+
{
337+
string repoPath = InitNewRepository();
338+
339+
using (var repo = new Repository(repoPath))
340+
{
341+
for (int i = 0; i < 10; i++)
342+
{
343+
Touch(repo.Info.WorkingDirectory, "test.txt",
344+
Guid.NewGuid().ToString());
345+
346+
repo.Index.Stage("test.txt");
347+
348+
Assert.DoesNotThrow(() => repo.Commit(
349+
"Commit", Constants.Signature, Constants.Signature));
350+
}
351+
}
352+
}
333353
}
334354
}

0 commit comments

Comments
 (0)