Re: url..insteadOf vs. submodules
On 20.02.2017 21:52, Jeff King wrote: > I think if there is a doc bug, it is that the repo boundary between the > submodule and the super-project is not made more clear. It's not mentioned anywhere I'm aware of, particularly not on the insteadOf docs. > That said, I do think it would be a useful feature for the super-project > to rewrite URLs before handing them off to the submodule. But I do not > really work on submodules nor use them myself, so there may be > complications. Agreed. > I suppose you could argue that failing to rewrite violates the "any" in > the quoted text. It doesn't say when the rewriting occurs, but it is > essentially "when the URL is accessed". So the super-project feeds the > raw URL to the submodule `git clone`, which then applies any URL > rewriting. >>> but one workaround is to set the config in ~/.gitconfig. >> >> No can do - that's under version control. >> My personal setup does not belong there I think ;-) > > I'm not sure I understand. You have a project policy to use certain > URLs. But you, the user, want to override that. Why isn't the > user-specific config file the right place to put that? Ah right, I mistook ~/ for "project root" instead of "home dir". Sorry for the confusion. > (I think there _is_ a mismatch, in that the change is specific not just > to your user, but to the repo. So you would not want to rewrite other > references to the same URL in other repos. Indeed, and that's actually a problem. The setup I'm aiming for is github -> local bare repo -> local clones with worktrees If I place insteadOf rules in ~/.gitconfig, I will be unable to pull from github to my local bare repos. Mmm... I could try to undo the insteadOf configuration from ~/.gitconfig in the local bare repos. Not sure whether I have to redirect from the github URL to itself. Downside is that I'll have to remember to modify ~/.gitconfig whenever the upstream project changes its dependencies. Or whenever I want to reorganize my local project directory structure. It's not totally out of the window, but right now it does not seem very attractive to me, and it's certainly not a good solution for everyone. Regards, Jo
Re: url..insteadOf vs. submodules
On 20.02.2017 10:01, Jeff King wrote: On Sun, Feb 19, 2017 at 10:12:28PM +0100, Toolforger wrote: I am trying to make url..insteadOf work on the URLs inside .gitmodules, but it won't work (applying it to the repo itself works fine, to the config setting seems to be fine). The submodule operations happen in their own processes, and do not look at the config of the parent repo. Ah, then we have a docbug. git help config has this to say: url..insteadOf Any URL that starts with this value will be rewritten to start, instead, with . The "Any" here is wrong, it would be "any except submodule" (possibly other exceptions). > Are you setting the config in .git/config of the super-project? Exactly. My thinking was that since the submodule URLs are specified in the super project's .gitmodules, that setting should apply. I don't know if there plans to make that work, It would certainly help me out, though I guess it's going to be too late for my current project :-) > but one workaround is to set the config in ~/.gitconfig. No can do - that's under version control. My personal setup does not belong there I think ;-) I am currently trying to write a shell script that - does git submodule init - pulls submodule configuration out of git config -l - configures each submodule with insteadOf It fits with my workflow because setting up the repositories is going to be done via script anyway. I'm neither a shell nor a git expert, so any advice still appreciated. Regards, Jo
url..insteadOf vs. submodules
Hi all, I am trying to make url..insteadOf work on the URLs inside .gitmodules, but it won't work (applying it to the repo itself works fine, to the config setting seems to be fine). I do not want to modify .gitmodules: It is maintained upstream. I cannot simply reconfigure submodule..url: the Configure script (regularly called during each compile) does git submodule sync git submodule update --init I could tell upstream to change these commands if I can make a good argument; for them, it is relevant that they can change the submodule URL inside .gitmodule and have it "just work" for everybody downstream. My own use case is that I want to be able to work with various experimental local clones even if I do not have Internet access. I'm all ears if there's a way to do this without using insteadOf. Here are the relevant two lines from the output of "git config -l" (after "git submodule init"): url./home/jo/Projekte/perl6/bare-repos.insteadof=https://github.com submodule.3rdparty/dynasm.url=https://github.com/MoarVM/dynasm.git Here is what "git submodule update" does: Cloning into '3rdparty/dyncall'... fatal: unable to access 'https://github.com/MoarVM/dyncall.git/': Could not resolve host: github.com fatal: clone of 'https://github.com/MoarVM/dyncall.git' into submodule path '3rdparty/dyncall' failed Any help appreciated! Regards, Jo