Repository navigation
Conversation
This addresses issue libgit2#2923.
|
Maintainerfolk: is adding a new function like this a good idea -- Or it be better to re-do and change the behavior of |
|
Hi @heavenlyhash ! Welcome and thanks for the nice first PR - this is delightful. I agree that I would like to avoid less API surface and make Would you mind hacking on a unit tests while you're in here? Do we need to beef up any other parts of the code base that assume that a remote has a |
|
Right, the idea is to make passing in a repsitory optional, rather than adding new APIs. In the |
|
I might need a little help getting the test coverage and additional checks in place. 0% skill navigating a large project in C (much less convincing myself I've done so exhaustively/correctly..) Will try to get a start though (especially since you have such lovely CI set up). The first thing that jumps out at me as a liiittle odd is that the |
Yeah, it's no joke. We've got a lot of unit tests, and our own test runner framework to boot. So there's a lot of overhead. If you want to get a start poking around with it, that would be great, and feel free to ask questions (here or in slack).
Yeah, that's definitely what I would do, too. 😄 |
|
Okay, great, thanks! Really appreciate the quick guidance on memory stuff Tests: looks like Error on fetch on a repoless remote: EINVALID seems like the closest match? Combinations of valid parameters: a |
There's some discussion on if we should skip having a new method at all and simply accept null repos from the existing API. In this change, that becomes possible as well, but what level of parameter validation to perform needs review (do names make sense without repos? Do fetchspecs?). Give the function a less silly name until that's settled, anyway.
|
Follow up on that last question about parameter validation: yeah, what's the convention to follow around combinatorially valid parameters and null checks? I fixed the repetitive code; all goes through
I tried Option 1 but ISTM it spirals towards messiness. For example, if Option 2 seems a little better, but means two of the functions panic on null repos, and the third one is fine. Maybe that's ok, but that seems like a api style and consistency thing I should check with you folks on? ... or I guess Option 3: make all three existing functions assert against null repos (as they do before this PR) and add a new function that has no repo param. (At least the implementation would be DRY now :3) Adds to API surface area; but seems most consistent. Preferences? |
|
Ping :) I put this down for a while and my memory's already getting dusty, but I think last time I looked, my favor was still towards adding a new function, so that the others can continue to reject null values as a whole instead of needing a matrix of conditions to be documented. The current state of the branch is with such a new function, and the implementation cleaned up. |
|
So ... is this being worked on or is it dead? |
|
Closed via #4233 |
|
Thanks @heavenlyhash ! |
This addresses #2923.
A new function
git_remote_create_anonymous2()creates a remote, given only a url. It behaves much likegit_remote_create_anonymous(), but performs much less work: it does not accept a repo param, it thus does not attempt to load any configuration or apply url rewriting rules.WIP/RFC. Dunno if this is a great solution; just took stab and this is the first place my code came to rest and, like, compiled. Not a C expert, so I put on my party hat and figured I'd PR (read: ask for adult supervision) from here :)