Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

Commit e59a0e7

Browse files
committed
Slightly enforce Revert() test coverage
1 parent 10ae2aa commit e59a0e7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

LibGit2Sharp.Tests/RevertFixture.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,5 +372,24 @@ public void CanRevertMergeCommit(int mainline, string expectedId)
372372
}
373373
}
374374
}
375+
376+
[Fact]
377+
public void CanNotRevertAMergeCommitWithoutSpecifyingTheMainlineBranch()
378+
{
379+
const string revertBranchName = "refs/heads/revert_merge";
380+
const string commitIdToRevert = "2747045";
381+
382+
string repoPath = CloneRevertTestRepo();
383+
using (var repo = new Repository(repoPath))
384+
{
385+
Branch branch = repo.Checkout(revertBranchName);
386+
Assert.NotNull(branch);
387+
388+
var commitToRevert = repo.Lookup<Commit>(commitIdToRevert);
389+
Assert.NotNull(commitToRevert);
390+
391+
Assert.Throws<LibGit2SharpException>(() => repo.Revert(commitToRevert, Constants.Signature));
392+
}
393+
}
375394
}
376395
}

0 commit comments

Comments
 (0)