diff options
author | Metalrom <romain.magny@gmail.com> | 2012-12-14 14:45:40 +0400 |
---|---|---|
committer | Metalrom <romain.magny@gmail.com> | 2012-12-14 20:32:41 +0400 |
commit | 0c290c4c8ae716d9309c201446b92abba79c9209 (patch) | |
tree | 3e1a8f56fcabb3474f7a6e9f9fedf2d916c0c059 /LibGit2Sharp.Tests | |
parent | 474cc1c1d1f855ddaa6bea08aef3289dd216c554 (diff) |
Adds Reset(ResetOptions resetOptions, Commit commit) method in Repository
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/ResetHeadFixture.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/LibGit2Sharp.Tests/ResetHeadFixture.cs b/LibGit2Sharp.Tests/ResetHeadFixture.cs index a6d94aaf..d757633c 100644 --- a/LibGit2Sharp.Tests/ResetHeadFixture.cs +++ b/LibGit2Sharp.Tests/ResetHeadFixture.cs @@ -36,6 +36,21 @@ namespace LibGit2Sharp.Tests } [Fact] + public void SoftResetToAParentCommitChangesTheTargetOfTheHead() + { + TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(); + + using (var repo = new Repository(path.RepositoryPath)) + { + var headCommit = repo.Head.Tip; + var firstCommitParent = headCommit.Parents.First(); + repo.Reset(ResetOptions.Soft, firstCommitParent); + + Assert.Equal(firstCommitParent, repo.Head.Tip); + } + } + + [Fact] public void SoftResetSetsTheHeadToTheDereferencedCommitOfAChainedTag() { TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(); @@ -53,7 +68,8 @@ namespace LibGit2Sharp.Tests { using (var repo = new Repository(BareTestRepoPath)) { - Assert.Throws<ArgumentNullException>(() => repo.Reset(ResetOptions.Soft, null)); + Assert.Throws<ArgumentNullException>(() => repo.Reset(ResetOptions.Soft, (string)null)); + Assert.Throws<ArgumentNullException>(() => repo.Reset(ResetOptions.Soft, (Commit)null)); Assert.Throws<ArgumentException>(() => repo.Reset(ResetOptions.Soft, "")); Assert.Throws<LibGit2SharpException>(() => repo.Reset(ResetOptions.Soft, Constants.UnknownSha)); Assert.Throws<LibGit2SharpException>(() => repo.Reset(ResetOptions.Soft, repo.Head.Tip.Tree.Sha)); |