Repository navigation
git_remote_create without insteadof rewrite rules #4658
Description
Activity
Workaround examples:
- freedomofpress/sunder@0111197
- Unable to update registry on CircleCI rust-lang/cargo#2429 (comment)
- Add override of command for CircleCI. iron/iron#487
- Add temporary workaround for CircleCI problem glium/glium#1452
- failed to authenticate when downloading repository rust-lang/cargo#3381 (comment)
- failed to authenticate when downloading repository rust-lang/cargo#3381 (comment)
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.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.This is merged now!
- On Tue, Nov 13, 2018 at 08:33:02AM -0800, Sergei Vorobev wrote: This is merged now!Thanks for keeping track and opening the feature request! :)
Prelude
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.
Question
This is somewhat similar to #2923 .
I'd like to use an equivalent of
git_remote_create_anonymousfunction, but without applyinginsteadofurl substitutions. This is similar togit_remote_create_detachedwhich explicitly says that it doesn't applyinsteadofsubstitues.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
~/.gitconfigsettings.For example, it's common to have
CircleCI uses this approach.
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-remotefunctionality with detached repos.