Thread (11 messages) 11 messages, 3 authors, 2017-02-22

Re: url.<base>.insteadOf vs. submodules

From: Toolforger <hidden>
Date: 2017-02-21 05:12:18

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.

quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help