-
Notifications
You must be signed in to change notification settings - Fork 876
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
Adds a Url property to the RemoteUpdater, which allows the remote url to... #803
Conversation
@@ -31,6 +32,7 @@ internal RemoteUpdater(Repository repo, Remote remote) | |||
|
|||
fetchRefSpecs = new UpdatingCollection<string>(GetFetchRefSpecs, SetFetchRefSpecs); | |||
pushRefSpecs = new UpdatingCollection<string>(GetPushRefSpecs, SetPushRefSpecs); | |||
url = GetRemoteUrl(); |
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.
Why not remote.Url?
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.
Actually, scrap that, don't even save the url locally. You have the remote saved so you can just do remote.Url everywhere.
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.
Doh!! Yes, of course. Thanks 👍
/cc @nulltoken Check my reviews. Is the RemoteSafeHandle immutable? Are changes that are done in native land nicely reflected over managed land? That's something I never thought to test. |
Thinking about it, can one think of a use case where we'd need a getter for the |
You rock 💟
The changes should indeed be reflected in unmanaged memory. Rule of thumb: we try to not keep hold of handles (except for major ones: repo, index, ...) in order to keep control of the memory allocation/release lifecycle. However, in this case, caching the RemoteSafeHandle may not require complex code. As the user cannot create a RemoteUpdater by him/herself and we control the lifecycle of the type, we may indeed do this. I've created #804 to tackle the handle topic. Let's keep this PR focused on adding the missing Url updation mechanism. |
I'd drop it. While we're talking about |
So they are. Carry on. 😇 |
Thanks for the feedback! I'll grab #804 when this is merged 😉 |
@@ -83,6 +83,22 @@ public virtual TagFetchMode TagFetchMode | |||
} | |||
|
|||
/// <summary> | |||
/// Sets the url defined for this <see cref="Remote"/> | |||
/// </summary> | |||
/// <remarks>Changing the url updates the <see cref="Remote" />.</remarks> |
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.
I see this remark exists on the RefSpecs
properties, but not on TagFetchMode
. I really don't know what it means... any existing Remote
instances will not change, but the one returned from Remotes.Update(…)
will. Thoughts, @nulltoken?
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.
Good catch! I overlooked this in #567.
@sitereactor Could you please drop those <remarks/>
where they appear?
@sitereactor Very cool PR! Once the last nitpick is tackled, could you please squash all those commits into one so we can get this merged? Optionally, if you feel like it, you can drop the existing |
@nulltoken I removed the |
@sitereactor Hmmm. That didn't go as expected. Let's try to fix this. First, make sure to fetch the latest tips from libgit2/libgit2sharp. This should update your local Then, given that your local checked out branch is The following should do the trick
Then a force push should dynamically update the PR. |
Thanks @nulltoken that seemed to do the trick ⭐ |
@sitereactor ✨ |
... be updated.
This is a PR for issue #788
Includes a single test case for verifying that the remote url was indeed changed.
Let me know if anything needs to be changed or corrected for this PR.