Re: Intricacies of submodules
- From
Ping Yin <pkufranky@gmail.com>
- Date
- Apr 12, 2008, 06:26 UTC
- Message-ID
- <46dff0320804112326v7beccd1dp3dc9fdb5c81bb25d@mail.gmail.com>
- In-Reply-To
- <7vej9blk4j.fsf@gitster.siamese.dyndns.org>
On Sat, Apr 12, 2008 at 1:25 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
> "Ping Yin" <pkufranky@gmail.com> writes: > > > >> After working with the project for a while (i.e. you pull and perhaps push > >> back or send patches upstream), .gitmodules file changes and it now says > >> the repository resides at host B.xz because the project relocated. You > >> would want the next "git submodule update" to notice that your .git/config > >> records a URL you derived from git://A.xz/project.git/, and that you have > >> not seen this new URL git://B.xz/project.git/, and give you a chance to > >> make adjustments if needed. > > > > I think this should be done if "git submodule update" fails. The > > reason it fails may be different, such as newest commits not pushed > > out and the subproject relocated etc. So it can only given some hints > > with "maybe". > > > > However, how to detect the url has changed in .gitmodules? Compare the > > latest two version of .gitmodules? > > That's why I suggested (and Roman seems to have got it, so I do not think > what I wrote was too confusing to be understood) you should record the set > of _all_ URLs you have _seen_ in .git/config. If the URL in .gitmodules > checked out is included in that set, you do not do anything. Otherwise > you ask.
I don't think it deserves such a change (say recoding history urls to $GIT_DIR/config) to just ask just the user whether to change url in $GIT_CONFIG/config when the url in .gitmodules changes to a new one.
Actually, i think this is an ugly solution :-)
Show 7 quoted lines
> > I think "git submodule update" is a good place to do that check, but I'd > prefer it be done _before_ it actually goes to the network to start > accessing potentially stale URL. The old URL may not be defunct but the > project decided not to advertise it to be used for some non-technical > reason (e.g. the site owner asked them not to point at it and instead use > some other mirrors).
If only the protocol (such as http://->git://) is different between urls in $GIT_DIR/config and .gitmodules, i think use "url.base.insteadOf = newbase" is simpler.
If the urls are totally different, when url in .gitmodules changes, there is little chance that the url in $GIT_DIR/config will also change.
-- Ping Yin