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:
-rw-r--r--LibGit2Sharp.Tests/BranchFixture.cs8
-rw-r--r--LibGit2Sharp.Tests/CheckoutFixture.cs27
-rw-r--r--LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/a0/5af239478ccff5315f6ab78c00a8ee88aa3cbbbin0 -> 180 bytes
-rw-r--r--LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/be/5028b2f245165f015927020e41247f8a3c0dfebin0 -> 73733 bytes
-rw-r--r--LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/f3/7d751802fa49ac4b6abd21d8298fc5a20231ea1
-rw-r--r--LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/refs/heads/logo1
6 files changed, 36 insertions, 1 deletions
diff --git a/LibGit2Sharp.Tests/BranchFixture.cs b/LibGit2Sharp.Tests/BranchFixture.cs
index 95010aad..ac5e407c 100644
--- a/LibGit2Sharp.Tests/BranchFixture.cs
+++ b/LibGit2Sharp.Tests/BranchFixture.cs
@@ -193,7 +193,12 @@ namespace LibGit2Sharp.Tests
{
using (var repo = new Repository(StandardTestRepoWorkingDirPath))
{
- var expectedWdBranches = new[] { "diff-test-cases", "i-do-numbers", "master", "track-local", "origin/HEAD", "origin/br2", "origin/master", "origin/packed-test", "origin/test" };
+ var expectedWdBranches = new[]
+ {
+ "diff-test-cases", "i-do-numbers", "logo", "master", "track-local",
+ "origin/HEAD", "origin/br2", "origin/master", "origin/packed-test",
+ "origin/test"
+ };
Assert.Equal(expectedWdBranches, repo.Branches.Select(b => b.Name).ToArray());
}
@@ -208,6 +213,7 @@ namespace LibGit2Sharp.Tests
{
new { Name = "diff-test-cases", Sha = "e7039e6d0e7dd4d4c1e2e8e5aa5306b2776436ca", IsRemote = false },
new { Name = "i-do-numbers", Sha = "7252fe2da2c4dd6d85231a150d0485ec46abaa7a", IsRemote = false },
+ new { Name = "logo", Sha = "f37d751802fa49ac4b6abd21d8298fc5a20231ea", IsRemote = false },
new { Name = "master", Sha = "32eab9cb1f450b5fe7ab663462b77d7f4b703344", IsRemote = false },
new { Name = "track-local", Sha = "580c2111be43802dab11328176d94c391f1deae9", IsRemote = false },
new { Name = "origin/HEAD", Sha = "580c2111be43802dab11328176d94c391f1deae9", IsRemote = true },
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.
diff --git a/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/a0/5af239478ccff5315f6ab78c00a8ee88aa3cbb b/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/a0/5af239478ccff5315f6ab78c00a8ee88aa3cbb
new file mode 100644
index 00000000..a9675384
--- /dev/null
+++ b/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/a0/5af239478ccff5315f6ab78c00a8ee88aa3cbb
Binary files differ
diff --git a/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/be/5028b2f245165f015927020e41247f8a3c0dfe b/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/be/5028b2f245165f015927020e41247f8a3c0dfe
new file mode 100644
index 00000000..89834852
--- /dev/null
+++ b/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/be/5028b2f245165f015927020e41247f8a3c0dfe
Binary files differ
diff --git a/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/f3/7d751802fa49ac4b6abd21d8298fc5a20231ea b/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/f3/7d751802fa49ac4b6abd21d8298fc5a20231ea
new file mode 100644
index 00000000..b6b50f6c
--- /dev/null
+++ b/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/objects/f3/7d751802fa49ac4b6abd21d8298fc5a20231ea
@@ -0,0 +1 @@
+xAj!EY&&W G`;9AV<820ZNcLɒ: Uݹ1` ;rdb0Q'b1[b?ƭu8+|J%I|^ʹ\b_@QwF JۛR?Rx A랇yJhUW \ No newline at end of file
diff --git a/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/refs/heads/logo b/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/refs/heads/logo
new file mode 100644
index 00000000..8bd833a0
--- /dev/null
+++ b/LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/refs/heads/logo
@@ -0,0 +1 @@
+f37d751802fa49ac4b6abd21d8298fc5a20231ea