Skip to content

Commit 17d1921

Browse files
committed
cleanup
1 parent 6e94b65 commit 17d1921

File tree

11 files changed

+14
-61
lines changed

11 files changed

+14
-61
lines changed

src/GitVersion.LibGit2Sharp/Git/Branch.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ namespace GitVersion
66
{
77
internal class Branch : IBranch
88
{
9-
private static readonly LambdaEqualityHelper<IBranch> equalityHelper =
10-
new LambdaEqualityHelper<IBranch>(x => x.CanonicalName);
11-
private static readonly LambdaKeyComparer<IBranch, string> comparerHelper =
12-
new LambdaKeyComparer<IBranch, string>(x => x.CanonicalName);
9+
private static readonly LambdaEqualityHelper<IBranch> equalityHelper = new(x => x.CanonicalName);
10+
private static readonly LambdaKeyComparer<IBranch, string> comparerHelper = new(x => x.CanonicalName);
1311

1412
private readonly LibGit2Sharp.Branch innerBranch;
1513

@@ -18,9 +16,6 @@ internal Branch(LibGit2Sharp.Branch branch)
1816
innerBranch = branch;
1917
}
2018

21-
protected Branch()
22-
{
23-
}
2419
public int CompareTo(IBranch other) => comparerHelper.Compare(this, other);
2520
public override bool Equals(object obj) => Equals(obj as IBranch);
2621
public bool Equals(IBranch other) => equalityHelper.Equals(this, other);
@@ -53,7 +48,6 @@ public virtual ICommitCollection Commits
5348
{
5449
get
5550
{
56-
5751
var commits = innerBranch.Commits;
5852
return commits is null ? null : new CommitCollection(commits);
5953
}

src/GitVersion.LibGit2Sharp/Git/BranchCollection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ internal class BranchCollection : IBranchCollection
99
private readonly LibGit2Sharp.BranchCollection innerCollection;
1010
internal BranchCollection(LibGit2Sharp.BranchCollection collection) => innerCollection = collection;
1111

12-
protected BranchCollection()
13-
{
14-
}
15-
1612
public virtual IEnumerator<IBranch> GetEnumerator()
1713
{
1814
return innerCollection.Select(branch => new Branch(branch)).GetEnumerator();

src/GitVersion.LibGit2Sharp/Git/Commit.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ namespace GitVersion
66
{
77
internal class Commit : ICommit
88
{
9-
private static readonly LambdaEqualityHelper<ICommit> equalityHelper =
10-
new LambdaEqualityHelper<ICommit>(x => x.Id);
11-
private static readonly LambdaKeyComparer<ICommit, string> comparerHelper =
12-
new LambdaKeyComparer<ICommit, string>(x => x.Sha);
9+
private static readonly LambdaEqualityHelper<ICommit> equalityHelper = new(x => x.Id);
10+
private static readonly LambdaKeyComparer<ICommit, string> comparerHelper = new(x => x.Sha);
1311

1412
private readonly LibGit2Sharp.Commit innerObjectId;
1513

@@ -18,10 +16,6 @@ internal Commit(LibGit2Sharp.Commit objectId)
1816
innerObjectId = objectId;
1917
}
2018

21-
protected Commit()
22-
{
23-
}
24-
2519
public int CompareTo(ICommit other) => comparerHelper.Compare(this, other);
2620
public override bool Equals(object obj) => Equals(obj as ICommit);
2721
public bool Equals(ICommit other) => equalityHelper.Equals(this, other);

src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ internal class CommitCollection : ICommitCollection
1111
private readonly ICommitLog innerCollection;
1212
internal CommitCollection(ICommitLog collection) => innerCollection = collection;
1313

14-
protected CommitCollection()
15-
{
16-
}
17-
1814
public virtual IEnumerator<ICommit> GetEnumerator()
1915
{
2016
return innerCollection.Select(commit => new Commit(commit)).GetEnumerator();

src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ private void AddMissingRefSpecs(LibGit2Sharp.Remote remote)
229229

230230
private static FetchOptions GetFetchOptions(AuthenticationInfo auth)
231231
{
232-
return new FetchOptions
232+
return new()
233233
{
234234
CredentialsProvider = GetCredentialsProvider(auth)
235235
};
236236
}
237237
private static CloneOptions GetCloneOptions(AuthenticationInfo auth)
238238
{
239-
return new CloneOptions
239+
return new()
240240
{
241241
Checkout = false,
242242
CredentialsProvider = GetCredentialsProvider(auth)

src/GitVersion.LibGit2Sharp/Git/ObjectId.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ namespace GitVersion
44
{
55
internal class ObjectId : IObjectId
66
{
7-
private static readonly LambdaEqualityHelper<IObjectId> equalityHelper =
8-
new LambdaEqualityHelper<IObjectId>(x => x.Sha);
9-
private static readonly LambdaKeyComparer<IObjectId, string> comparerHelper =
10-
new LambdaKeyComparer<IObjectId, string>(x => x.Sha);
7+
private static readonly LambdaEqualityHelper<IObjectId> equalityHelper = new(x => x.Sha);
8+
private static readonly LambdaKeyComparer<IObjectId, string> comparerHelper = new(x => x.Sha);
119

1210
private readonly LibGit2Sharp.ObjectId innerObjectId;
1311
internal ObjectId(LibGit2Sharp.ObjectId objectId)

src/GitVersion.LibGit2Sharp/Git/Reference.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ namespace GitVersion
55
{
66
internal class Reference : IReference
77
{
8-
private static readonly LambdaEqualityHelper<IReference> equalityHelper =
9-
new LambdaEqualityHelper<IReference>(x => x.CanonicalName);
10-
private static readonly LambdaKeyComparer<IReference, string> comparerHelper =
11-
new LambdaKeyComparer<IReference, string>(x => x.CanonicalName);
8+
private static readonly LambdaEqualityHelper<IReference> equalityHelper = new(x => x.CanonicalName);
9+
private static readonly LambdaKeyComparer<IReference, string> comparerHelper = new(x => x.CanonicalName);
1210

1311
internal readonly LibGit2Sharp.Reference innerReference;
1412
private DirectReference directReference => innerReference.ResolveToDirectReference();
@@ -18,10 +16,6 @@ internal Reference(LibGit2Sharp.Reference reference)
1816
innerReference = reference;
1917
}
2018

21-
protected Reference()
22-
{
23-
}
24-
2519
public int CompareTo(IReference other) => comparerHelper.Compare(this, other);
2620
public override bool Equals(object obj) => Equals(obj as IReference);
2721
public bool Equals(IReference other) => equalityHelper.Equals(this, other);

src/GitVersion.LibGit2Sharp/Git/ReferenceCollection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ internal class ReferenceCollection : IReferenceCollection
99
private readonly LibGit2Sharp.ReferenceCollection innerCollection;
1010
internal ReferenceCollection(LibGit2Sharp.ReferenceCollection collection) => innerCollection = collection;
1111

12-
protected ReferenceCollection()
13-
{
14-
}
15-
1612
public virtual IEnumerator<IReference> GetEnumerator()
1713
{
1814
return innerCollection.Select(reference => new Reference(reference)).GetEnumerator();

src/GitVersion.LibGit2Sharp/Git/Remote.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ namespace GitVersion
55
{
66
internal class Remote : IRemote
77
{
8-
private static readonly LambdaEqualityHelper<IRemote> equalityHelper =
9-
new LambdaEqualityHelper<IRemote>(x => x.Name);
10-
private static readonly LambdaKeyComparer<IRemote, string> comparerHelper =
11-
new LambdaKeyComparer<IRemote, string>(x => x.Name);
8+
private static readonly LambdaEqualityHelper<IRemote> equalityHelper = new(x => x.Name);
9+
private static readonly LambdaKeyComparer<IRemote, string> comparerHelper = new(x => x.Name);
1210

1311
private readonly LibGit2Sharp.Remote innerRemote;
1412

@@ -17,10 +15,6 @@ internal Remote(LibGit2Sharp.Remote remote)
1715
innerRemote = remote;
1816
}
1917

20-
protected Remote()
21-
{
22-
}
23-
2418
public int CompareTo(IRemote other) => comparerHelper.Compare(this, other);
2519
public override bool Equals(object obj) => Equals(obj as IRemote);
2620
public bool Equals(IRemote other) => equalityHelper.Equals(this, other);

src/GitVersion.LibGit2Sharp/Git/Tag.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,15 @@ namespace GitVersion
55
{
66
internal class Tag : ITag
77
{
8-
private static readonly LambdaEqualityHelper<ITag> equalityHelper =
9-
new LambdaEqualityHelper<ITag>(x => x.CanonicalName);
10-
private static readonly LambdaKeyComparer<ITag, string> comparerHelper =
11-
new LambdaKeyComparer<ITag, string>(x => x.CanonicalName);
8+
private static readonly LambdaEqualityHelper<ITag> equalityHelper = new(x => x.CanonicalName);
9+
private static readonly LambdaKeyComparer<ITag, string> comparerHelper = new(x => x.CanonicalName);
1210

1311
private readonly LibGit2Sharp.Tag innerTag;
1412
internal Tag(LibGit2Sharp.Tag tag)
1513
{
1614
innerTag = tag;
1715
}
1816

19-
protected Tag()
20-
{
21-
}
22-
2317
public int CompareTo(ITag other) => comparerHelper.Compare(this, other);
2418
public override bool Equals(object obj) => Equals(obj as ITag);
2519
public bool Equals(ITag other) => equalityHelper.Equals(this, other);

0 commit comments

Comments
 (0)