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:
authoryorah <yoram.harmelin@gmail.com>2013-03-11 18:35:03 +0400
committernulltoken <emeric.fermas@gmail.com>2013-04-09 23:03:33 +0400
commitc4b4f9382da0571b1ff76b263255a9e3e412b491 (patch)
tree8324487e3954213cc2963131273271e263b5ae42 /LibGit2Sharp.Tests/ResetIndexFixture.cs
parent3f5bf001d622c5dfbeb5dd46df2bf739a07f7cc7 (diff)
Add ExplicitPathsOptions to Repository.Reset()
Diffstat (limited to 'LibGit2Sharp.Tests/ResetIndexFixture.cs')
-rw-r--r--LibGit2Sharp.Tests/ResetIndexFixture.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/LibGit2Sharp.Tests/ResetIndexFixture.cs b/LibGit2Sharp.Tests/ResetIndexFixture.cs
index 39ac1648..8b3a1e2f 100644
--- a/LibGit2Sharp.Tests/ResetIndexFixture.cs
+++ b/LibGit2Sharp.Tests/ResetIndexFixture.cs
@@ -124,16 +124,27 @@ namespace LibGit2Sharp.Tests
}
[Fact]
- public void CanResetTheIndexToASubsetOfTheContentOfACommitWithCommitAsArgument()
+ public void CanResetTheIndexToASubsetOfTheContentOfACommitWithCommitAsArgumentAndLaxUnmatchedExplicitPathsValidation()
{
string path = CloneStandardTestRepo();
using (var repo = new Repository(path))
{
- repo.Reset(repo.Lookup<Commit>("5b5b025"), new[] { "new.txt" });
+ repo.Reset(repo.Lookup<Commit>("5b5b025"), new[] { "new.txt", "non-existent-path-28.txt" },
+ new ExplicitPathsOptions { ShouldFailOnUnmatchedPath = false });
Assert.Equal("a8233120f6ad708f843d861ce2b7228ec4e3dec6", repo.Index["README"].Id.Sha);
Assert.Equal("fa49b077972391ad58037050f2a75f74e3671e92", repo.Index["new.txt"].Id.Sha);
}
}
+
+ [Fact]
+ public void ResettingTheIndexToASubsetOfTheContentOfACommitWithCommitAsArgumentAndStrictUnmatchedPathspecsValidationThrows()
+ {
+ using (var repo = new Repository(CloneStandardTestRepo()))
+ {
+ Assert.Throws<UnmatchedPathException>(() =>
+ repo.Reset(repo.Lookup<Commit>("5b5b025"), new[] { "new.txt", "non-existent-path-28.txt" }, new ExplicitPathsOptions()));
+ }
+ }
}
}