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>2013-01-23 17:58:20 +0400
committernulltoken <emeric.fermas@gmail.com>2013-01-23 21:15:11 +0400
commit1ccfc718b8e2919430b2942a6c1c14cb1284029d (patch)
treeac978e39dd51dd684062f0c08c37c9f66c36b4ad /LibGit2Sharp.Tests/CheckoutFixture.cs
parent80dcc97f83e2c7183328d9f813f3f870bb35af79 (diff)
Ensure Checkout() doesn't mess with binary files
Fix #302
Diffstat (limited to 'LibGit2Sharp.Tests/CheckoutFixture.cs')
-rw-r--r--LibGit2Sharp.Tests/CheckoutFixture.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/CheckoutFixture.cs b/LibGit2Sharp.Tests/CheckoutFixture.cs
index 97738b49..244b7ce0 100644
--- a/LibGit2Sharp.Tests/CheckoutFixture.cs
+++ b/LibGit2Sharp.Tests/CheckoutFixture.cs
@@ -573,6 +573,33 @@ namespace LibGit2Sharp.Tests
}
}
+ [Fact]
+ public void CheckingOutABranchDoesNotAlterBinaryFiles()
+ {
+ TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(StandardTestRepoWorkingDirPath);
+ using (var repo = new Repository(path.RepositoryPath))
+ {
+ // $ git hash-object azure3.png
+ // be5028b2f245165f015927020e41247f8a3c0dfe
+ const string expectedSha = "be5028b2f245165f015927020e41247f8a3c0dfe";
+
+ // The blob actually exists in the object database with the correct Sha
+ Assert.Equal(expectedSha, repo.Lookup<Blob>(expectedSha).Sha);
+
+ repo.Checkout("refs/heads/logo",
+ CheckoutOptions.Force, null);
+
+ // The Index has been updated as well with the blob
+ Assert.Equal(expectedSha, repo.Index["azure3.png"].Id.Sha);
+
+ // Recreating a Blob from the checked out file...
+ Blob blob = repo.ObjectDatabase.CreateBlob("azure3.png");
+
+ // ...generates the same Sha
+ Assert.Equal(expectedSha, blob.Id.Sha);
+ }
+ }
+
/// <summary>
/// Helper method to populate a simple repository with
/// a single file and two branches.