Skip to content

Commit a6ddc5c

Browse files
committed
Ensure Stage() detects minor changes in a tight loop
1 parent 856b422 commit a6ddc5c

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
@@ -314,5 +314,25 @@ public void CanStageIgnoredPaths(string path)
314314
Assert.Equal(FileStatus.Added, repo.Index.RetrieveStatus(path));
315315
}
316316
}
317+
318+
[Fact]
319+
public void CanSuccessfullyStageTheContentOfAModifiedFileOfTheSameSizeWithinTheSameSecond()
320+
{
321+
string repoPath = InitNewRepository();
322+
323+
using (var repo = new Repository(repoPath))
324+
{
325+
for (int i = 0; i < 10; i++)
326+
{
327+
Touch(repo.Info.WorkingDirectory, "test.txt",
328+
Guid.NewGuid().ToString());
329+
330+
repo.Index.Stage("test.txt");
331+
332+
Assert.DoesNotThrow(() => repo.Commit(
333+
"Commit", Constants.Signature, Constants.Signature));
334+
}
335+
}
336+
}
317337
}
318338
}

0 commit comments

Comments
 (0)