Skip to content

Remove equality comparison from Remote #1286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions LibGit2Sharp.Tests/RemoteFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,28 +123,6 @@ public void CanSetRemotePushUrl()
}
}

[Fact]
public void CanCheckEqualityOfRemote()
{
string path = SandboxStandardTestRepo();
using (var repo = new Repository(path))
{
Remote oneOrigin = repo.Network.Remotes["origin"];
Assert.NotNull(oneOrigin);

Remote otherOrigin = repo.Network.Remotes["origin"];
Assert.Equal(oneOrigin, otherOrigin);

Remote createdRemote = repo.Network.Remotes.Add("origin2", oneOrigin.Url);

Remote loadedRemote = repo.Network.Remotes["origin2"];
Assert.NotNull(loadedRemote);
Assert.Equal(createdRemote, loadedRemote);

Assert.NotEqual(oneOrigin, loadedRemote);
}
}

[Fact]
public void CreatingANewRemoteAddsADefaultRefSpec()
{
Expand Down
24 changes: 1 addition & 23 deletions LibGit2Sharp/Remote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ namespace LibGit2Sharp
/// A remote repository whose branches are tracked.
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class Remote : IEquatable<Remote>, IBelongToARepository, IDisposable
public class Remote : IBelongToARepository, IDisposable
{
private static readonly LambdaEqualityHelper<Remote> equalityHelper =
new LambdaEqualityHelper<Remote>(x => x.Name, x => x.Url, x => x.PushUrl);

internal readonly Repository repository;

private readonly RefSpecCollection refSpecs;
Expand Down Expand Up @@ -182,25 +179,6 @@ public override bool Equals(object obj)
return Equals(obj as Remote);
}

/// <summary>
/// Determines whether the specified <see cref="Remote"/> is equal to the current <see cref="Remote"/>.
/// </summary>
/// <param name="other">The <see cref="Remote"/> to compare with the current <see cref="Remote"/>.</param>
/// <returns>True if the specified <see cref="Remote"/> is equal to the current <see cref="Remote"/>; otherwise, false.</returns>
public bool Equals(Remote other)
{
return equalityHelper.Equals(this, other);
}

/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>A 32-bit signed integer hash code.</returns>
public override int GetHashCode()
{
return equalityHelper.GetHashCode(this);
}

/// <summary>
/// Tests if two <see cref="Remote"/> are equal.
/// </summary>
Expand Down