Skip to content

Commit 2e96549

Browse files
committed
CommitLog can be sealed because it has interface
1 parent f43d558 commit 2e96549

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

LibGit2Sharp.Tests/MockedRepositoryFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void CanCountCommitsWithConcreteRepository()
2929
[Fact]
3030
public void CanCountCommitsWithMockedRepository()
3131
{
32-
var commitLog = Mock.Of<CommitLog>(cl => cl.GetEnumerator() == FakeCommitLog(17));
32+
var commitLog = Mock.Of<IQueryableCommitLog>(cl => cl.GetEnumerator() == FakeCommitLog(17));
3333
var repo = Mock.Of<IRepository>(r => r.Commits == commitLog);
3434

3535
var commitCounter = new CommitCounter(repo);

LibGit2Sharp/CommitLog.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@ namespace LibGit2Sharp
1111
/// <summary>
1212
/// A log of commits in a <see cref="Repository"/>
1313
/// </summary>
14-
public class CommitLog : IQueryableCommitLog
14+
public sealed class CommitLog : IQueryableCommitLog
1515
{
1616
private readonly Repository repo;
1717
private readonly CommitFilter queryFilter;
1818

19-
/// <summary>
20-
/// Needed for mocking purposes.
21-
/// </summary>
22-
protected CommitLog()
23-
{ }
24-
2519
/// <summary>
2620
/// Initializes a new instance of the <see cref="CommitLog"/> class.
2721
/// The commits will be enumerated according in reverse chronological order.
@@ -46,7 +40,7 @@ internal CommitLog(Repository repo, CommitFilter queryFilter)
4640
/// <summary>
4741
/// Gets the current sorting strategy applied when enumerating the log
4842
/// </summary>
49-
public virtual CommitSortStrategies SortedBy
43+
public CommitSortStrategies SortedBy
5044
{
5145
get { return queryFilter.SortBy; }
5246
}
@@ -57,7 +51,7 @@ public virtual CommitSortStrategies SortedBy
5751
/// Returns an enumerator that iterates through the log.
5852
/// </summary>
5953
/// <returns>An <see cref="IEnumerator{T}"/> object that can be used to iterate through the log.</returns>
60-
public virtual IEnumerator<Commit> GetEnumerator()
54+
public IEnumerator<Commit> GetEnumerator()
6155
{
6256
return new CommitEnumerator(repo, queryFilter);
6357
}
@@ -78,7 +72,7 @@ IEnumerator IEnumerable.GetEnumerator()
7872
/// </summary>
7973
/// <param name="filter">The options used to control which commits will be returned.</param>
8074
/// <returns>A list of commits, ready to be enumerated.</returns>
81-
public virtual ICommitLog QueryBy(CommitFilter filter)
75+
public ICommitLog QueryBy(CommitFilter filter)
8276
{
8377
Ensure.ArgumentNotNull(filter, "filter");
8478
Ensure.ArgumentNotNull(filter.Since, "filter.Since");
@@ -93,7 +87,7 @@ public virtual ICommitLog QueryBy(CommitFilter filter)
9387
/// <param name="first">The first <see cref="Commit"/>.</param>
9488
/// <param name="second">The second <see cref="Commit"/>.</param>
9589
/// <returns>The common ancestor or null if none found.</returns>
96-
public virtual Commit FindCommonAncestor(Commit first, Commit second)
90+
public Commit FindCommonAncestor(Commit first, Commit second)
9791
{
9892
Ensure.ArgumentNotNull(first, "first");
9993
Ensure.ArgumentNotNull(second, "second");
@@ -108,7 +102,7 @@ public virtual Commit FindCommonAncestor(Commit first, Commit second)
108102
/// </summary>
109103
/// <param name="commits">The <see cref="Commit"/>s for which to find the common ancestor.</param>
110104
/// <returns>The common ancestor or null if none found.</returns>
111-
public virtual Commit FindCommonAncestor(IEnumerable<Commit> commits)
105+
public Commit FindCommonAncestor(IEnumerable<Commit> commits)
112106
{
113107
Ensure.ArgumentNotNull(commits, "commits");
114108

0 commit comments

Comments
 (0)