Re: submodule network operations [WAS: Re: [RFC/PATCH 0/4] working tree operations: support superprefix]
- From
- Brian J. Davis <bitminer@gmail.com>
- Date
- Jan 21, 2017, 15:53 UTC
- Message-ID
- <04fe8035-dbf0-83d2-c465-f746b99ce609@gmail.com>
- In-Reply-To
- <CAGZ79kaS7zt3DKrRuqzzODc1HHEP-xd-8HBC0JA-HvmqAJOZfw@mail.gmail.com>
On 1/19/2017 7:22 PM, Stefan Beller wrote:
Show 19 quoted lines
>>> Between the init and the update step you can modify the URLs. >>> These commands are just a repetition from the first email, but the >>> git commands can be viewed as moving from one state to another >>> for submodules; submodules itself can be seen as a state machine >>> according to that proposed documentation. Maybe such a state machine >>> makes it easier to understand for some people. >> >> "Between the init and the update step you can modify the URLs." Yes I can >> and have to... wish it was not this way. > So how would yo u rather want to do it? > look at the .gitmodules file beforehand and then run a "submodule update" ? > Or a thing like > > git -c url.https://internal.insteadOf git://github.com/ \ > -c submodule.record-rewritten-urls submodule update > > (no need for init there as theoretically there is not > need for such an intermediate step) >
"Yes please and thank you" ... both.
My thought was to simply allow addition to .gitmodules. If I understand correctly you are proposing, to override these at the command line and possibly rewrite them on submodule update, but maybe not save or add to .gitmodules. I would then propose both. 1) allow user to add to .gitmodules for those who do not care that "outsiders" know the internal dev server and 2) allow to rewrite while not saving to .gitmodules on fresh clone and submodule update for thoes that do not want ousiders to known internal dev server. and possibly: 3) allow at command line to add remote to .gitmodules on submodule commands (note add optoin in -c <name> = <value> pair)
.gitmodules before:
[submodule "subprojects/wrangler"]
path = subprojects/wrangler
url = git://github.com/Then your adapted command:
git -c url.https://internal.insteadOf git://github.com/ \
-c submodule.record-rewritten-urls=add,internal --add submodule updatewould produce
[submodule "subprojects/projname"]
path = subprojects/projname
remote.origin.url = git://github.com/
remote.internal.url =https://internal.insteadOfOr similar support.
Show 17 quoted lines
>>> [remote "origin"] >>> url = https://github.com/.. >>> [remote "inhouse"] >>> url = https://inhouse.corp/.. >>> >>> But where do we clone it from? >>> (Or do we just do a "git init" on that submodule and fetch >>> from both remotes? in which order?) >> origin by default and inhouse if specified. There is already a implied >> default (origin). The idea was not to do both but rather what is specified. >> Origin and inhouse are just names for remotes. If one wanted a >> "--all-remotes" could pull from everywhere in the Ether if feature was to be >> implemented. > How is origin implied to be the default? > Should there be an order (e.g. if you cannot find it at inhouse get it > from github, > if they are down, get it from kernel.org)
As it is in the Highlander series... "there can be only one" (remote). So that is what I mean by origin. The only remote allowed is the "origin" unless changed by the user... but there can still only be one *currently*. Though I see your point as it is not labeled "origin". It is not labeled at all. Apologies for confusion there.