git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Intricacies of submodules

From
Ping Yin <pkufranky@gmail.com>
Date
Apr 12, 2008, 04:02 UTC
Message-ID
<46dff0320804112102t52a60072rc97c772a1e74f597@mail.gmail.com>
In-Reply-To
<7v63uqz265.fsf@gitster.siamese.dyndns.org>
On Thu, Apr 10, 2008 at 1:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
>  The original discussion that led to the current implementation dates back
>  in May-June timeframe of 2007.  I would not be surprised if not all of the
>  good ideas were incorporated in the current implementation.  For example,
>  one thing that we may want to do is to record what contents we've seen in
>  the .gitmodules file in order to prime each entry in .git/config, so that
>  we can give users a chance to adjust what is in .git/config when we notice
>  the entry in .gitmodules has changed.
>
>  For example, consider that .gitmodules said the submodule should be taken
>  from repository URL git://A.xz/project.git when you cloned.  You may have
>  used the given URL as-is to prime your .git/config, or you may have chosen
>  to use http://A.xz/project.git/ for networking reasons.
>
>  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?

And if only the protocol or domain changes of the submodule between $GIT_CONFIG/config and .gitmodules, i think the "url.<usethis>.insteadof = <otherurl>" form introduced in v1.5.5 is more helpful.

Show 13 quoted lines
>
>  After that happens, if you seeked to an old version (perhaps you wanted to
>  work on an old bug), .gitmodules file that is checked out of that old
>  version may say the "upstream" is at A.xz, but the entry in .git/config
>  may already be based on B.xz.  But because you have already seen this old
>  URL in .gitmodules, you may not want to get asked about adjusting the
>  entry in .git/config merely because you checked out an old version.  What
>  this means is that it is not enough to just record "What the current URL
>  you chose to use is" in .git/config (which is obvious), and it is also not
>  enough to record "what URL .gitmodules had when you made that choice", but
>  you would also need to record "What URLs you have _seen_ when making that
>  choice".
>

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?

-- 
Ping Yin
Previous: Roman ShaposhnikNext: Junio C Hamano
Message 41 of 48 in “Migrating svn to git with heavy use of externals”
  1. D. Stuart FreemanMar 31, 2008
  2. D. Stuart FreemanApr 8, 2008
  3. Avery PennarunApr 8, 2008
  4. D. Stuart FreemanApr 8, 2008
  5. Avery PennarunApr 8, 2008
  6. D. Stuart FreemanApr 8, 2008
  7. Roman ShaposhnikApr 9, 2008
  8. Avery PennarunApr 9, 2008
  9. Roman ShaposhnikApr 9, 2008
  10. Avery PennarunApr 9, 2008
  11. Junio C HamanoApr 9, 2008
  12. Intricacies of submodules [was: Migrating svn to git with heavy use of externals]Roman Shaposhnik, Apr 10, 2008
  13. Junio C HamanoApr 10, 2008
  14. Roman ShaposhnikApr 10, 2008
  15. Junio C HamanoApr 11, 2008
  16. Ping YinApr 11, 2008
  17. Junio C HamanoApr 11, 2008
  18. Roman ShaposhnikApr 12, 2008
  19. Junio C HamanoApr 12, 2008
  20. Roman ShaposhnikApr 14, 2008
  21. Junio C HamanoApr 15, 2008
  22. Ping YinApr 15, 2008
  23. Roman V. ShaposhnikApr 16, 2008
  24. Jeremy Maitin-ShepardApr 17, 2008
  25. Linus TorvaldsApr 17, 2008
  26. Junio C HamanoApr 17, 2008
  27. Roman V. ShaposhnikApr 17, 2008
  28. Martin LanghoffApr 17, 2008
  29. Junio C HamanoApr 17, 2008
  30. Sverre RabbelierApr 17, 2008
  31. Martin LanghoffApr 17, 2008
  32. Sverre RabbelierApr 17, 2008
  33. Martin LanghoffApr 17, 2008
  34. Ping YinApr 18, 2008
  35. Dmitry PotapovApr 17, 2008
  36. Linus TorvaldsApr 17, 2008
  37. Ping YinApr 18, 2008
  38. Jakub NarebskiApr 18, 2008
  39. Ping YinApr 12, 2008
  40. Roman ShaposhnikApr 14, 2008
  41. Ping YinApr 12, 2008
  42. Junio C HamanoApr 12, 2008
  43. Ping YinApr 12, 2008
  44. Ping YinApr 10, 2008
  45. Roman ShaposhnikApr 10, 2008
  46. Intricacies of submodules [was: Migrating svn to git with heavy use of externals]Roman Shaposhnik, Apr 9, 2008
  47. Avery PennarunApr 9, 2008
  48. Avery PennarunApr 18, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.