diff options
author | Aimeast <lixd3389@gmail.com> | 2013-10-27 12:55:54 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-10-27 12:58:21 +0400 |
commit | 71090d33681029b4c88cf43b8e27b2783ecccefc (patch) | |
tree | 00c891c8a07c534cee7e0a576cbeab626bf5e160 /LibGit2Sharp.Tests | |
parent | 2e201d57c089559c560fb3ddab36bfe985848d23 (diff) |
Deprecate Blob.Content
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/BlobFixture.cs | 16 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs | 5 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs | 5 |
3 files changed, 9 insertions, 17 deletions
diff --git a/LibGit2Sharp.Tests/BlobFixture.cs b/LibGit2Sharp.Tests/BlobFixture.cs index 5b4c5a58..d725240f 100644 --- a/LibGit2Sharp.Tests/BlobFixture.cs +++ b/LibGit2Sharp.Tests/BlobFixture.cs @@ -68,7 +68,7 @@ namespace LibGit2Sharp.Tests var commit = repo.Commit("bom", Constants.Signature, Constants.Signature); var blob = (Blob)commit.Tree[bomFile].Target; - Assert.Equal(expectedContentBytes, blob.Content.Length); + Assert.Equal(expectedContentBytes, blob.GetContentStream().Length); var textDetected = blob.GetContentText(); Assert.Equal(content, textDetected); @@ -102,20 +102,6 @@ namespace LibGit2Sharp.Tests } [Fact] - public void CanReadBlobContent() - { - using (var repo = new Repository(BareTestRepoPath)) - { - var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6"); - byte[] bytes = blob.Content; - Assert.Equal(10, bytes.Length); - - string content = Encoding.UTF8.GetString(bytes); - Assert.Equal("hey there\n", content); - } - } - - [Fact] public void CanReadBlobStream() { using (var repo = new Repository(BareTestRepoPath)) diff --git a/LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs b/LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs index 289650f7..2d631434 100644 --- a/LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs +++ b/LibGit2Sharp.Tests/DiffTreeToTreeFixture.cs @@ -466,7 +466,10 @@ namespace LibGit2Sharp.Tests // Recreate the file in the workdir without the executable bit string fullpath = Path.Combine(repo.Info.WorkingDirectory, file); File.Delete(fullpath); - File.WriteAllBytes(fullpath, ((Blob)(entry.Target)).Content); + using (var stream = ((Blob)(entry.Target)).GetContentStream()) + { + Touch(repo.Info.WorkingDirectory, file, stream); + } // Unset the local core.filemode, if any. repo.Config.Unset("core.filemode"); diff --git a/LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs b/LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs index a8578d04..2b7c528c 100644 --- a/LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs +++ b/LibGit2Sharp.Tests/DiffWorkdirToIndexFixture.cs @@ -114,7 +114,10 @@ namespace LibGit2Sharp.Tests // Recreate the file in the workdir without the executable bit string fullpath = Path.Combine(repo.Info.WorkingDirectory, file); File.Delete(fullpath); - File.WriteAllBytes(fullpath, ((Blob)(entry.Target)).Content); + using (var stream = ((Blob)(entry.Target)).GetContentStream()) + { + Touch(repo.Info.WorkingDirectory, file, stream); + } // Unset the local core.filemode, if any. repo.Config.Unset("core.filemode", ConfigurationLevel.Local); |