Repository navigation
Remote revamp - #304
Remote revamp#304arthurschreiber merged 30 commits into
Conversation
|
Looks pretty good! I think that a |
|
A note about |
|
As soon as #307 gets merged, I'll probably rework parts of this to feature a similar API. |
|
Is this still the pull request that will implement push/pull support over ssh? |
|
Yes. Now that #307 has landed, I'll spend some time over the next days to rework this to feature a similar API. |
|
@vmg @cmn Can you take a look after the recent changes I pushed? This PR has grown quite in size and scope, and I'm not sure how to feel about that. I could break this up into a bunch of smaller PRs that are more focused and would be easier to review. Right now, this PR contains:
|
@cmn I think I still do. The problem is that I can't leave the connection open because I don't know which direction it was opened in (or I'd have to check that and then handle that correctly by reopening the connection). Or am I wrong? |
|
If you're not exposing |
|
I wonder if someone might actually want access to the individual steps of a fetch or push, but that can be added whenever; it's good that there's a larger wrapper around it. I'm not a fan of calling the user-pass cred simply |
Mmh. Now that we have
What about |
|
Yeah, keeping low-level commands and duping for everything else should work, if anybody actually wants to us it. I'd wait until someone actually does, though. No sense in trying to add it back in now.
|
|
Just realized that the little pull request I sent #338 conflicts with the larger changes here. This code is still all very unfamiliar to me, but is there anything I can do to help with this one? |
|
I've added a branch here https://github.com/albertsun/rugged/tree/merge-304 that has the commits from here and the commits from #338 merged together along with a test_clone_over_ssh_with_credentials_and_branch test. |
|
@albertsun I'd rather you finish up the work on #338, and I can merge this seperately. This PR here needs some restructuring anyway, so you shouldn't have bothered. 😄 |
|
Are there any plans to merge this PR soon? |
|
I'm also waiting for its merge. It's quite difficult for me to resolve conflicts each time when other commits merged |
|
I reworked the whole patchset a bit, and cleaned up the code and commit history.
I played around with an alternative API that would've exposed the callbacks through properties on the Overall, this should be ready to get merged soon. |
|
AFAICT I've a couple of patches on top on this branch in my fork (under the same name), though the changes I made to libgit2 for accessing the remote's data doesn't get used, as you set the credentials on a cloned remote and the data in on the stack anyway. What I tried to do was remove complexity and decisions from the code. So all the credentials get set in the remote, but it's decided during the callback whether to call it. This by itself doesn't help all that much, but this did lead me straight into the next change, which is to have a macro to check whether the callbacks are callable, which reduces the amount of code one has to look through, and makes the differences between the four if blocks clearer (IMO). |
|
I like the change in carlosmn@0d14bc7, while I think the change in carlosmn@542d4c2 doesn't really help much.
Yeah, you're right, I must haveve missed this somehow. I just pushed the missing functionality and some test cases. |
|
That first commit removes changing code form the if-block. If we don't move it out of there, we need to make the macro more complex and somewhat uglier. |
|
@carlosmn I cherry picked your changes, thank you very much! ❤️ I think the last tiny thing missing is support for the |
|
Agreed. Those would be nice to have, but they can be added later. We would need for my PR to libgit2 to get merged before, as we depend on the unmerged PASSTHROUGH behaviour. |
|
@vmg Is there anything left to do before we can get this merged? |
We should try to fallback to whatever push refspecs are set in the remote, or raise an error if no push refspecs can be found.
This may not turn out to help as much as I thought, as rugged fills in its options structure in a line of ifs anyway.
There's a ton of code which does the same thing but with a different string. Use a macro to reduce how much code one has to read to see what we're doing.
|
@vmg Done. |
…ntials Credentials support for Rugged::Remote.
|
Great |
This revamps the
Rugged::Remoteimplementation that we currently have.It removes the low-level
#connect,#connected?,#disconnectand#update_tipsmethods in favor of "automatic" connection handling, which should be less error-prone and easier to use.Remote#lswas modified to reflect this change.Additionally,
Remote#fetchwas implemented with the same credentials support asRepository#clone_at, reusing most of the code that was there.As part of the changes, support for the
:progressand:update_tipscallbacks was added toRepository#clone_at, and theoptionsHash structure was tweaked a bit.Remote#pushis still WIP, but should be added soon.I'm not a 100% sure about the API - maybe
#fetchand#pushshould be on theRepositoryinstead ofRemote? Or what about addingRepository#fetchandRepository#pushconvenience methods that take either aRemoteor aurl(and just forward toRemote#push/Remote#fetch)?