You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
git_remote_create without insteadof rewrite rules #4658
Apoligies in advance for openning an issue that could be viewed more like an API question and not a bug report. I asked on stackoverflow as suggested, but didn't get any replies.
It's unclear to me that this is even possible to achive with the current public APIs at all. Hence, I think it's appropriate to open an issue in this repo.
I'd like to use an equivalent of git_remote_create_anonymous function, but without applying insteadof url substitutions. This is similar to git_remote_create_detached which explicitly says that it doesn't apply insteadof substitues.
I could not find an equivalent API or combination of APIs that would get me a fetchable repo without the global config substitutes applied.
Am I missing something? If not, would it be reasonable to add such API?
Motivation
The use-case of it is to bypass any users global ~/.gitconfig settings.
For example, it's common to have
That causes somewhat unpredictable behavior for tools that use github repos for their online indexes, like cargo. Users find workaround for it, but it would be really nice to put more control in the hands of tools authors, so they can bypass the rewrite rules. libgit2 already does it for git ls-remote functionality with detached repos.
I'm not really against adding API for that, I'm just wondering about this (after having written the code 🤷♂️) :
If your ultimate goal is to ignore the user's .gitconfig, what prevents you from manually building a git_config instance and switching the repository to that instead of using the default ? See git_repository_set_config and git_config_open_ondisk.
AFAIU, your repoes are not really user-accessible ?
On the subject of API changes, this can bring down the 4 git_remote_create* functions we have down to 2. If this is deemed a worthy goal, I can PR the code I have.
I think it's sensible to provide a way of creating remotes without paying attention to insteadof rules.
The current design of our creation functions is a bit unfortunate, as none of these functions is able to accept an opts structure. But changing existing public API to fix that is a no-go, unfortunately, so that we make sure to not break our users. One way to fix this situation is to just provide a new set of functions git_remote_create_*_with_opts, which would allow us to do future changes without breaking the API. Yeah, it is ugly, but I don't see a better way to do this while keeping our API.
Yes, making it extensible for the future is a great idea. @tiennou just used a name git_remote_create_ext in the #4667 , which I think a consistent C name for such cases (I'm very far from C expert, don't quote me on it).
Activity
vors commentedon May 28, 2018
Workaround examples:
tiennou commentedon May 29, 2018
I'm not really against adding API for that, I'm just wondering about this (after having written the code 🤷♂️) :
If your ultimate goal is to ignore the user's
.gitconfig, what prevents you from manually building agit_configinstance and switching the repository to that instead of using the default ? See git_repository_set_config and git_config_open_ondisk.AFAIU, your repoes are not really user-accessible ?
On the subject of API changes, this can bring down the 4
git_remote_create*functions we have down to 2. If this is deemed a worthy goal, I can PR the code I have.pks-t commentedon Jun 1, 2018
I think it's sensible to provide a way of creating remotes without paying attention to insteadof rules.
The current design of our creation functions is a bit unfortunate, as none of these functions is able to accept an
optsstructure. But changing existing public API to fix that is a no-go, unfortunately, so that we make sure to not break our users. One way to fix this situation is to just provide a new set of functionsgit_remote_create_*_with_opts, which would allow us to do future changes without breaking the API. Yeah, it is ugly, but I don't see a better way to do this while keeping our API.vors commentedon Jun 1, 2018
Yes, making it extensible for the future is a great idea. @tiennou just used a name
git_remote_create_extin the #4667 , which I think a consistent C name for such cases (I'm very far from C expert, don't quote me on it).vors commentedon Nov 13, 2018
This is merged now!
pks-t commentedon Nov 14, 2018
Unset CircleCI's forced conversion of HTTPS->SSH.
Unset CircleCI's forced conversion of HTTPS->SSH.
Unset CircleCI's forced conversion of HTTPS->SSH.