Re: Intricacies of submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Ping Yin" <pkufranky@xxxxxxxxx> 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 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).

> When bug happens, i only care the commit in the index of submodule and
> wheter i can check out the old submodule commit. However, does it
> really matter that what the url of the submodule is?

No.  The discussion was what should _not_ happen when you run "git
submodule update" from that state.  Usually in a steadily advancing
history, you _want_ "git submodule update" to notice that the suggested
remote URL has changed in .gitmodules and give the user a chance to adjust
the URL _before_ it hits the network, but you obviously do not want it to
happen only because you happened to be at a seeked back commit when you
initiated "git submodule update".  In other words, you are agreeing with
me without really reading what I wrote ;-)  It does not matter, and
recording the URLs you have _seen_ (not "the last one you saw", or "the
one you initialized .git/config with") is a way to make sure that the
fixed "git submodule update" agrees with us on that point.



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux