diff options
author | nulltoken <emeric.fermas@gmail.com> | 2015-01-10 15:28:28 +0300 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2015-01-21 15:43:45 +0300 |
commit | f4c7bd6d27d9d35641114d5db360c4ed82f43c94 (patch) | |
tree | 3bf01fbbc00f1f5d0b1d631706b61c9f1ededb4b /LibGit2Sharp.Tests | |
parent | 18745ed113fd0058b6fdbcdb43b55802ae7a3c37 (diff) |
Teach low level Index.Add() to accept a Blob
Fix #195
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/IndexFixture.cs | 19 |
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(); |