Skip to content

Commit 302c162

Browse files
committed
Merge pull request #688 from libgit2/ntk/subsecond_staging
repo.Index.Stage() won't notice a change if it occurs within the same second
2 parents 37bdb63 + db02403 commit 302c162

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
@@ -372,5 +372,25 @@ public void CanStageConflictedIgnoredFiles(string filename, FileStatus expected)
372372
Assert.Equal(expected, repo.RetrieveStatus(filename));
373373
}
374374
}
375+
376+
[Fact]
377+
public void CanSuccessfullyStageTheContentOfAModifiedFileOfTheSameSizeWithinTheSameSecond()
378+
{
379+
string repoPath = InitNewRepository();
380+
381+
using (var repo = new Repository(repoPath))
382+
{
383+
for (int i = 0; i < 10; i++)
384+
{
385+
Touch(repo.Info.WorkingDirectory, "test.txt",
386+
Guid.NewGuid().ToString());
387+
388+
repo.Stage("test.txt");
389+
390+
Assert.DoesNotThrow(() => repo.Commit(
391+
"Commit", Constants.Signature, Constants.Signature));
392+
}
393+
}
394+
}
375395
}
376396
}

0 commit comments

Comments
 (0)