10000 Merge pull request #1286 from libgit2/cmn/remote-no-equal · libgit2/libgit2sharp@68d9be9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 68d9be9

Browse files
author
Edward Thomson
committed
Merge pull request #1286 from libgit2/cmn/remote-no-equal
Remove equality comparison from Remote
2 parents 4038caf + 92b55d1 commit 68d9be9

File tree

2 files changed

+1
-45
lines changed

2 files changed

+1
-45
lines changed

LibGit2Sharp.Tests/RemoteFixture.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -123,28 +123,6 @@ public void CanSetRemotePushUrl()
123123
}
124124
}
125125

126-
[Fact]
127-
public void CanCheckEqualityOfRemote()
128-
{
129-
string path = SandboxStandardTestRepo();
130-
using (var repo = new Repository(path))
131-
{
132-
Remote oneOrigin = repo.Network.Remotes["origin"];
133-
Assert.NotNull(oneOrigin);
134-
135-
Remote otherOrigin = repo.Network.Remotes["origin"];
136-
Assert.Equal(oneOrigin, otherOrigin);
137-
138-
Remote createdRemote = repo.Network.Remotes.Add("origin2", oneOrigin.Url);
139-
140-
Remote loadedRemote = repo.Network.Remotes["origin2"];
141-
Assert.NotNull(loadedRemote);
142-
Assert.Equal(createdRemote, loadedRemote);
143-
144-
Assert.NotEqual(oneOrigin, loadedRemote);
145-
}
146-
}
147-
148126
[Fact]
149127
public void CreatingANewRemoteAddsADefaultRefSpec()
150128
{

LibGit2Sharp/Remote.cs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ namespace LibGit2Sharp
1212
/// A remote repository whose branches are tracked.
1313
/// </summary>
1414
[DebuggerDisplay("{DebuggerDisplay,nq}")]
15-
public class Remote : IEquatable<Remote>, IBelongToARepository, IDisposable
15+
public class Remote : IBelongToARepository, IDisposable
1616
{
17-
private static readonly LambdaEqualityHelper<Remote> equalityHelper =
18-
new LambdaEqualityHelper<Remote>(x => x.Name, x => x.Url, x => x.PushUrl);
19-
2017
internal readonly Repository repository;
2118

2219
private readonly RefSpecCollection refSpecs;
@@ -182,25 +179,6 @@ public override bool Equals(object obj)
182179
return Equals(obj as Remote);
183180
}
184181

185-
/// <summary>
186-
/// Determines whether the specified <see cref="Remote"/> is equal to the current <see cref="Remote"/>.
187-
/// </summary>
188-
/// <param name="other">The <see cref="Remote"/> to compare with the current <see cref="Remote"/>.</param>
189-
/// <returns>True if the specified <see cref="Remote"/> is equal to the current <see cref="Remote"/>; otherwise, false.</returns>
190-
public bool Equals(Remote other)
191-
{
192-
return equalityHelper.Equals(this, other);
193-
}
194-
195-
/// <summary>
196-
/// Returns the hash code for this instance.
197-
/// </summary>
198-
/// <returns>A 32-bit signed integer hash code.</returns>
199-
public override int GetHashCode()
200-
{
201-
return equalityHelper.GetHashCode(this);
202-
}
203-
204182
/// <summary>
205183
/// Tests if two <see cref="Remote"/> are equal.
206184
/// </summary>

0 commit comments

Comments
 (0)
0