-
Notifications
You must be signed in to change notification settings - Fork 899
Introduce RemoteCollection.Remove() #731
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,5 +189,30 @@ public void CanCreateARemoteWithASpecifiedFetchRefSpec() | |
Assert.Equal("+refs/heads/*:refs/remotes/grmpf/*", remote.RefSpecs.Single().Specification); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void CanDeleteExistingRemote() | ||
{ | ||
var path = CloneStandardTestRepo(); | ||
using (var repo = new Repository(path)) | ||
{ | ||
Assert.NotNull(repo.Network.Remotes["origin"]); | ||
Assert.NotEmpty(repo.Refs.FromGlob("refs/remotes/origin/*")); | ||
|
||
repo.Network.Remotes.Remove("origin"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please assert that
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add a test that shows that removing a non existing remote doesn't throw (cf BranchFixture.CanRemoveANonExistingBranch())? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, sec, that changes the functionality a bit. :D |
||
Assert.Null(repo.Network.Remotes["origin"]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...end ensure it gets dropped here |
||
Assert.Empty(repo.Refs.FromGlob("refs/remotes/origin/*")); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void CanDeleteNonExistingRemote() | ||
{ | ||
using (var repo = new Repository(StandardTestRepoPath)) | ||
{ | ||
Assert.Null(repo.Network.Remotes["i_dont_exist"]); | ||
repo.Network.Remotes.Remove("i_dont_exist"); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please assert refs/remotes/origin/test exists here....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the API for getting that exact string? Only things I'm seeing is refSpecs stuff from either config or the remote itself.
I guess config is the place to check, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still isn't in the latest rebase, so the diff shouldn't be marked as outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like
Assert.NotNull(repo.Branches["origin/test"]);
should work.