Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2015-01-10 15:28:28 +0300
committernulltoken <emeric.fermas@gmail.com>2015-01-21 15:43:45 +0300
commitf4c7bd6d27d9d35641114d5db360c4ed82f43c94 (patch)
tree3bf01fbbc00f1f5d0b1d631706b61c9f1ededb4b /LibGit2Sharp.Tests
parent18745ed113fd0058b6fdbcdb43b55802ae7a3c37 (diff)
Teach low level Index.Add() to accept a Blob
Fix #195
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r--LibGit2Sharp.Tests/IndexFixture.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/IndexFixture.cs b/LibGit2Sharp.Tests/IndexFixture.cs
index c6752525..2529f54e 100644
--- a/LibGit2Sharp.Tests/IndexFixture.cs
+++ b/LibGit2Sharp.Tests/IndexFixture.cs
@@ -412,6 +412,25 @@ namespace LibGit2Sharp.Tests
}
[Fact]
+ public void CanAddAnEntryToTheIndexFromABlob()
+ {
+ var path = SandboxStandardTestRepoGitDir();
+ using (var repo = new Repository(path))
+ {
+ const string targetIndexEntryPath = "1.txt";
+ var before = repo.RetrieveStatus(targetIndexEntryPath);
+ Assert.Equal(FileStatus.Unaltered, before);
+
+ var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
+
+ repo.Index.Add(blob, targetIndexEntryPath, Mode.NonExecutableFile);
+
+ var after = repo.RetrieveStatus(targetIndexEntryPath);
+ Assert.Equal(FileStatus.Staged | FileStatus.Modified, after);
+ }
+ }
+
+ [Fact]
public void AddingAnEntryToTheIndexFromAUnknwonFileInTheWorkdirThrows()
{
var path = SandboxStandardTestRepoGitDir();